This commit is contained in:
samo_lego 2020-06-29 12:06:02 +02:00
parent 19964910de
commit 103d634eb2
5 changed files with 23 additions and 10 deletions

View File

@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.4-SNAPSHOT'
id 'fabric-loom' version '0.4.29'
id 'maven-publish'
}

View File

@ -2,12 +2,12 @@
org.gradle.jvmargs=-Xmx1G
# Fabric properties
minecraft_version=1.16
yarn_mappings=1.16+build.1
minecraft_version=1.16.1
yarn_mappings=1.16.1+build.17
loader_version=0.8.8+build.202
#Fabric api
fabric_version=0.13.1+build.370-1.16
fabric_version=0.14.0+build.371-1.16
# Mod Properties
mod_version = 1.4.4

View File

@ -238,13 +238,25 @@ public class SimpleAuth implements DedicatedServerModInitializer {
}
PlayerCache cache = deauthenticatedUsers.get(convertUuid(player));
// Puts player to last cached position
player.teleport(
server.getWorld(RegistryKey.of(Registry.DIMENSION, new Identifier(cache.lastDim))),
try {
player.teleport(
server.getWorld(RegistryKey.of(Registry.DIMENSION, new Identifier(cache.lastDim))),
cache.lastX,
cache.lastY,
cache.lastZ,
0,
0
);
} catch (Error e) {
player.sendMessage(new LiteralText(config.lang.corruptedPosition), false);
LOGGER.error("[SimpleAuth] Couldn't teleport player " + player.getName().asString());
LOGGER.error(
String.format("[SimpleAuth] Last recorded position is X: %s, Y: %s, Z: %s in dimension %s",
cache.lastX,
cache.lastY,
cache.lastZ,
0,
0
);
cache.lastDim
));
}
}
}

View File

@ -93,6 +93,7 @@ public class AuthConfig {
public String disallowedUsername = "§6Invalid username characters! Allowed character regex: %s";
public String playerAlreadyOnline = "§cPlayer %s is already online!";
public String worldSpawnSet = "§aSpawn for logging in was set successfully.";
public String corruptedPosition = "§cYour position data is probably corrupted. Please contact admin.";
}
public static class ExperimentalConfig {
// Prevents player being kicked because another player with the same name has joined the server

View File

@ -38,7 +38,7 @@ public class PlayerCache {
this.lastAir = player.getAir();
// Setting position cache
this.lastDim = String.valueOf(player.getEntityWorld().getDimension());
this.lastDim = String.valueOf(player.getEntityWorld().getRegistryKey().getValue());
this.lastX = player.getX();
this.lastY = player.getY();
this.lastZ = player.getZ();