diff --git a/gradle.properties b/gradle.properties index e966a32..5fc6f30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,11 +3,11 @@ org.gradle.jvmargs=-Xmx1G # Fabric properties minecraft_version=20w22a -yarn_mappings=20w22a+build.1 -loader_version=0.8.4+build.198 +yarn_mappings=20w22a+build.5 +loader_version=0.8.5+build.199 #Fabric api -fabric_version=0.11.0+build.349-1.16 +fabric_version=0.11.2+build.351-1.16 # Mod Properties mod_version = 1.4.3 diff --git a/src/main/java/org/samo_lego/simpleauth/commands/AuthCommand.java b/src/main/java/org/samo_lego/simpleauth/commands/AuthCommand.java index 07246c0..821db98 100644 --- a/src/main/java/org/samo_lego/simpleauth/commands/AuthCommand.java +++ b/src/main/java/org/samo_lego/simpleauth/commands/AuthCommand.java @@ -9,8 +9,6 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.text.LiteralText; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.World; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.samo_lego.simpleauth.SimpleAuth; @@ -47,28 +45,22 @@ public class AuthCommand { ) .then(literal("setSpawn") .executes( ctx -> setSpawn( - ctx.getSource(), - new Identifier(String.valueOf(ctx.getSource().getWorld().getDimension())), - ctx.getSource().getEntityOrThrow().getX(), - ctx.getSource().getEntityOrThrow().getY(), - ctx.getSource().getEntityOrThrow().getZ() + ctx.getSource(), + ctx.getSource().getEntityOrThrow().getEntityWorld().method_27983().getValue(), + ctx.getSource().getEntityOrThrow().getX(), + ctx.getSource().getEntityOrThrow().getY(), + ctx.getSource().getEntityOrThrow().getZ() )) .then(argument("dimension", DimensionArgumentType.dimension()) .then(argument("position", BlockPosArgumentType.blockPos()) - .executes(ctx -> { - RegistryKey worldRegistryKey = DimensionArgumentType.getDimensionArgument(ctx, "dimension"); - //Registry registry = ctx.getSource().getWorld().getServer().method_29174().getRegistry(); - return setSpawn( - ctx.getSource(), - //Objects.requireNonNull(registry.get(dimension.getValue())), - worldRegistryKey.getValue(), - //(ctx, "dimension id"), - BlockPosArgumentType.getLoadedBlockPos(ctx, "position").getX(), - // +1 to not spawn player in ground - BlockPosArgumentType.getLoadedBlockPos(ctx, "position").getY() + 1, - BlockPosArgumentType.getLoadedBlockPos(ctx, "position").getZ() - ); - } + .executes(ctx -> setSpawn( + ctx.getSource(), + DimensionArgumentType.getDimensionArgument(ctx, "dimension").getValue(), + BlockPosArgumentType.getLoadedBlockPos(ctx, "position").getX(), + // +1 to not spawn player in ground + BlockPosArgumentType.getLoadedBlockPos(ctx, "position").getY() + 1, + BlockPosArgumentType.getLoadedBlockPos(ctx, "position").getZ() + ) ) ) ) @@ -136,9 +128,6 @@ public class AuthCommand { // private static int setSpawn(ServerCommandSource source, Identifier world, double x, double y, double z) { - // Getting dimension registry - //Registry registry = source.getWorld().getServer().method_29435(); - // Setting config values and saving config.worldSpawn.dimension = String.valueOf(world); config.worldSpawn.x = x; diff --git a/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java b/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java index faf2906..9b0c101 100644 --- a/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java +++ b/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java @@ -83,7 +83,7 @@ public class AuthEventHandler { if ( playerCache.wasAuthenticated && playerCache.validUntil >= System.currentTimeMillis() && - playerCache.lastIp.equals(player.getIp()) + player.getIp().equals(playerCache.lastIp) ) { deauthenticatedUsers.remove(uuid); // Makes player authenticated return; diff --git a/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java b/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java index 7e1e361..47a2944 100644 --- a/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java +++ b/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java @@ -5,7 +5,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.Identifier; import static org.samo_lego.simpleauth.SimpleAuth.config; import static org.samo_lego.simpleauth.SimpleAuth.db; @@ -34,18 +33,12 @@ public class PlayerCache { if(player != null) { this.lastIp = player.getIp(); - // Getting dimension registry - //Registry registry = Objects.requireNonNull(player.getServer()).method_29435().getRegistry(); - // Setting position cache - this.lastDim = String.valueOf(new Identifier(String.valueOf(player.getEntityWorld().getDimension()))); + this.lastDim = String.valueOf(player.getEntityWorld().getDimension()); this.lastX = player.getX(); this.lastY = player.getY(); this.lastZ = player.getZ(); } - else { - this.lastIp = ""; - } if(db.isUserRegistered(uuid)) { String data = db.getData(uuid); @@ -62,8 +55,6 @@ public class PlayerCache { if (lastLoc != null) { // Getting DB coords JsonObject lastLocation = gson.fromJson(lastLoc.getAsString(), JsonObject.class); - //String dim = Objects.requireNonNull(Objects.requireNonNull(player).getServer()).method_29174().getRegistry().get(new Identifier(dim)); - // Extra long line to get dimension from string this.lastDim = lastLocation.get("dim").getAsString(); this.lastX = lastLocation.get("x").getAsDouble(); this.lastY = lastLocation.get("y").getAsDouble();