This commit is contained in:
samo_lego 2020-08-02 17:39:04 +02:00
parent eed619cbb0
commit 14fcda580e
2 changed files with 16 additions and 2 deletions

View File

@ -114,7 +114,6 @@ public class AuthEventHandler {
// Teleporting player to the middle of the block // Teleporting player to the middle of the block
player.teleport(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5); player.teleport(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
playerCache.wasInPortal = true;
} }
} }
@ -154,7 +153,17 @@ public class AuthEventHandler {
// Player movement // Player movement
public static ActionResult onPlayerMove(PlayerEntity player) { 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.FAIL;
} }
return ActionResult.PASS; return ActionResult.PASS;

View File

@ -53,8 +53,13 @@ public class AuthConfig {
// Visit https://github.com/samolego/SimpleAuth/wiki/Sessions for more info // Visit https://github.com/samolego/SimpleAuth/wiki/Sessions for more info
public int sessionTimeoutTime = 60; 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) // Whether to tp player to spawn when joining (to hide coordinates)
public boolean spawnOnJoin = false; public boolean spawnOnJoin = false;
// Data for spawn (where deauthenticated players are teleported)
public static class WorldSpawn { public static class WorldSpawn {
public String dimension; public String dimension;
public double x; public double x;