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 3934c70..ddd536c 100644 --- a/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java +++ b/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java @@ -114,7 +114,6 @@ public class AuthEventHandler { // Teleporting player to the middle of the block player.teleport(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5); - playerCache.wasInPortal = true; } } @@ -154,7 +153,17 @@ public class AuthEventHandler { // Player movement public static ActionResult onPlayerMove(PlayerEntity player) { - if(!isAuthenticated((ServerPlayerEntity) player) && !config.experimental.allowMovement) { + // Player will fall if enabled (prevent fly kick) + boolean auth = isAuthenticated((ServerPlayerEntity) player); + if(!auth && config.main.allowFalling && !player.isOnGround() && !player.isInsideWaterOrBubbleColumn()) { + if(player.isInvulnerable()) + player.setInvulnerable(false); + return ActionResult.PASS; + } + // Otherwise movement should be disabled + else if(!auth && !config.experimental.allowMovement) { + if(!player.isInvulnerable()) + player.setInvulnerable(true); return ActionResult.FAIL; } return ActionResult.PASS; diff --git a/src/main/java/org/samo_lego/simpleauth/storage/AuthConfig.java b/src/main/java/org/samo_lego/simpleauth/storage/AuthConfig.java index 3a0e2d2..3b6542e 100644 --- a/src/main/java/org/samo_lego/simpleauth/storage/AuthConfig.java +++ b/src/main/java/org/samo_lego/simpleauth/storage/AuthConfig.java @@ -53,8 +53,13 @@ public class AuthConfig { // Visit https://github.com/samolego/SimpleAuth/wiki/Sessions for more info public int sessionTimeoutTime = 60; + // Should deauthenticated players fall if the login mid-air? + public boolean allowFalling = false; + // Whether to tp player to spawn when joining (to hide coordinates) public boolean spawnOnJoin = false; + + // Data for spawn (where deauthenticated players are teleported) public static class WorldSpawn { public String dimension; public double x;