Stopped console from getting spammed with erros by the players module

This commit is contained in:
blackilykat 2023-09-07 18:31:21 +02:00
parent a794ebd7d3
commit ec6a142b73

View file

@ -138,7 +138,7 @@ public class Players extends Listener {
if (accessor == null) return;
final PlayerListEntryAccessor entryAccessor = (PlayerListEntryAccessor) accessor.playerListEntries().get(newEntry.profile().getId());
if(entryAccessor == null) return;
entryAccessor.setGameMode(newEntry.gameMode());
} catch (Exception e) {
e.printStackTrace();
@ -157,6 +157,8 @@ public class Players extends Listener {
final PlayerListEntryAccessor entryAccessor = (PlayerListEntryAccessor) accessor.playerListEntries().get(newEntry.profile().getId());
if(entryAccessor == null) return;
entryAccessor.setLatency(newEntry.latency());
}
@ -169,8 +171,9 @@ public class Players extends Listener {
final ClientPlayNetworkHandlerAccessor accessor = ((ClientPlayNetworkHandlerAccessor) MinecraftClient.getInstance().getNetworkHandler());
if (accessor == null) return;
accessor.playerListEntries().get(newEntry.profile().getId()).setDisplayName(newEntry.displayName());
PlayerListEntry entry = accessor.playerListEntries().get(newEntry.profile().getId());
if(entry == null) return;
entry.setDisplayName(newEntry.displayName());
}
private void removePlayer (UUID uuid) {