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 { plugins {
id 'fabric-loom' version '0.4-SNAPSHOT' id 'fabric-loom' version '0.4.29'
id 'maven-publish' id 'maven-publish'
} }

View File

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

View File

@ -238,6 +238,7 @@ public class SimpleAuth implements DedicatedServerModInitializer {
} }
PlayerCache cache = deauthenticatedUsers.get(convertUuid(player)); PlayerCache cache = deauthenticatedUsers.get(convertUuid(player));
// Puts player to last cached position // Puts player to last cached position
try {
player.teleport( player.teleport(
server.getWorld(RegistryKey.of(Registry.DIMENSION, new Identifier(cache.lastDim))), server.getWorld(RegistryKey.of(Registry.DIMENSION, new Identifier(cache.lastDim))),
cache.lastX, cache.lastX,
@ -246,5 +247,16 @@ public class SimpleAuth implements DedicatedServerModInitializer {
0, 0,
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,
cache.lastDim
));
}
} }
} }

View File

@ -93,6 +93,7 @@ public class AuthConfig {
public String disallowedUsername = "§6Invalid username characters! Allowed character regex: %s"; public String disallowedUsername = "§6Invalid username characters! Allowed character regex: %s";
public String playerAlreadyOnline = "§cPlayer %s is already online!"; public String playerAlreadyOnline = "§cPlayer %s is already online!";
public String worldSpawnSet = "§aSpawn for logging in was set successfully."; 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 { public static class ExperimentalConfig {
// Prevents player being kicked because another player with the same name has joined the server // 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(); this.lastAir = player.getAir();
// Setting position cache // Setting position cache
this.lastDim = String.valueOf(player.getEntityWorld().getDimension()); this.lastDim = String.valueOf(player.getEntityWorld().getRegistryKey().getValue());
this.lastX = player.getX(); this.lastX = player.getX();
this.lastY = player.getY(); this.lastY = player.getY();
this.lastZ = player.getZ(); this.lastZ = player.getZ();