Finalising 20w22a, hooray

This commit is contained in:
samo_lego 2020-06-01 21:50:11 +02:00
parent 96bf9a52de
commit 27a5fa25fb
4 changed files with 18 additions and 38 deletions

View File

@ -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

View File

@ -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<World> worldRegistryKey = DimensionArgumentType.getDimensionArgument(ctx, "dimension");
//Registry<DimensionType> 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<DimensionType> registry = source.getWorld().getServer().method_29435();
// Setting config values and saving
config.worldSpawn.dimension = String.valueOf(world);
config.worldSpawn.x = x;

View File

@ -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;

View File

@ -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<DimensionType> 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();