Preventing #41 from happening in the future

This commit is contained in:
samolego 2020-12-06 22:11:06 +01:00
parent a1ce6b578f
commit 5a6f4f57aa
2 changed files with 9 additions and 6 deletions

View File

@ -119,8 +119,12 @@ public class AuthEventHandler {
if(config.main.sessionTimeoutTime != -1) if(config.main.sessionTimeoutTime != -1)
playerCache.validUntil = System.currentTimeMillis() + config.main.sessionTimeoutTime * 1000; playerCache.validUntil = System.currentTimeMillis() + config.main.sessionTimeoutTime * 1000;
} }
else if(config.main.spawnOnJoin) else if(config.main.spawnOnJoin) {
((PlayerAuth) player).hidePosition(false); ((PlayerAuth) player).hidePosition(false);
player.setInvulnerable(!config.experimental.playerInvulnerable);
player.setInvisible(!config.experimental.playerInvisible);
}
} }
// Player chatting // Player chatting

View File

@ -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 * @param authenticated whether player should be authenticated
*/ */
@Override @Override
public void setAuthenticated(boolean authenticated) { public void setAuthenticated(boolean authenticated) {
PlayerCache playerCache = playerCacheMap.get(this.getFakeUuid()); PlayerCache playerCache = playerCacheMap.get(this.getFakeUuid());
if(this.isAuthenticated() == authenticated)
return;
playerCache.isAuthenticated = authenticated; playerCache.isAuthenticated = authenticated;
player.setInvulnerable(!authenticated && config.experimental.playerInvulnerable); player.setInvulnerable(!authenticated && config.experimental.playerInvulnerable);
player.setInvisible(!authenticated && config.experimental.playerInvisible); player.setInvisible(!authenticated && config.experimental.playerInvisible);
@ -167,7 +165,8 @@ public class MixinServerPlayerEntity implements PlayerAuth {
/** /**
* Whether the player is using the mojang account. * 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 @Override
public boolean isUsingMojangAccount() { public boolean isUsingMojangAccount() {