From 5a6f4f57aa7df3942d37ec37421c87133c806162 Mon Sep 17 00:00:00 2001 From: samolego <34912839+samolego@users.noreply.github.com> Date: Sun, 6 Dec 2020 22:11:06 +0100 Subject: [PATCH] Preventing #41 from happening in the future --- .../org/samo_lego/simpleauth/event/AuthEventHandler.java | 6 +++++- .../simpleauth/mixin/MixinServerPlayerEntity.java | 9 ++++----- 2 files changed, 9 insertions(+), 6 deletions(-) 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 150839d..4975f70 100644 --- a/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java +++ b/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java @@ -119,8 +119,12 @@ public class AuthEventHandler { if(config.main.sessionTimeoutTime != -1) playerCache.validUntil = System.currentTimeMillis() + config.main.sessionTimeoutTime * 1000; } - else if(config.main.spawnOnJoin) + else if(config.main.spawnOnJoin) { ((PlayerAuth) player).hidePosition(false); + + player.setInvulnerable(!config.experimental.playerInvulnerable); + player.setInvisible(!config.experimental.playerInvisible); + } } // Player chatting diff --git a/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayerEntity.java b/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayerEntity.java index 9ae0115..3a6aa3c 100644 --- a/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayerEntity.java +++ b/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayerEntity.java @@ -102,18 +102,16 @@ public class MixinServerPlayerEntity implements PlayerAuth { } /** - * Sets the authentication status of the player. + * Sets the authentication status of the player + * and hides coordinates if needed. * * @param authenticated whether player should be authenticated */ @Override public void setAuthenticated(boolean authenticated) { PlayerCache playerCache = playerCacheMap.get(this.getFakeUuid()); - if(this.isAuthenticated() == authenticated) - return; playerCache.isAuthenticated = authenticated; - player.setInvulnerable(!authenticated && config.experimental.playerInvulnerable); player.setInvisible(!authenticated && config.experimental.playerInvisible); @@ -167,7 +165,8 @@ public class MixinServerPlayerEntity implements PlayerAuth { /** * Whether the player is using the mojang account. - * @return true if paid, otherwise false + * + * @return true if they are using mojang account, otherwise false */ @Override public boolean isUsingMojangAccount() {