From 554a770a4d0496f60cb911bae45b075954a6f78f Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Thu, 7 Dec 2023 19:24:21 +0600 Subject: [PATCH 1/3] Update NetHandlerPlayClientMixin.java --- .../client/mixin/mixins/NetHandlerPlayClientMixin.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/silentclient/client/mixin/mixins/NetHandlerPlayClientMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/NetHandlerPlayClientMixin.java index 528a329..844b870 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/NetHandlerPlayClientMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/NetHandlerPlayClientMixin.java @@ -4,6 +4,7 @@ import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.network.play.server.S01PacketJoinGame; import net.minecraft.network.play.server.S19PacketEntityStatus; import net.minecraft.network.play.server.S48PacketResourcePackSend; import net.minecraft.util.IChatComponent; @@ -32,10 +33,14 @@ public class NetHandlerPlayClientMixin { at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;displayGuiScreen(Lnet/minecraft/client/gui/GuiScreen;)V") ) private GuiScreen skipTerrainScreen(GuiScreen original) { - Players.reload(); return null; } + @Inject(method = "handleJoinGame", at = @At(value = "RETURN")) + public void resetPlayers(S01PacketJoinGame packetIn, CallbackInfo ci) { + Players.reload(); + } + //#if MC==10809 @Inject(method = "handleResourcePack", at = @At("HEAD"), cancellable = true) private void silent$resourceExploitFix(S48PacketResourcePackSend packetIn, CallbackInfo ci) { From 454fd1b2f80c3b6f6e502328797c1d8a4d961159 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Thu, 7 Dec 2023 19:38:32 +0600 Subject: [PATCH 2/3] Update Players.java --- src/main/java/net/silentclient/client/utils/Players.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/silentclient/client/utils/Players.java b/src/main/java/net/silentclient/client/utils/Players.java index 2dfb54e..29bd1af 100644 --- a/src/main/java/net/silentclient/client/utils/Players.java +++ b/src/main/java/net/silentclient/client/utils/Players.java @@ -18,6 +18,7 @@ public class Players { public static boolean isLoading = false; public static void reload() { + Client.logger.info("Clearing players cache"); playersCache.clear(); } @@ -101,7 +102,7 @@ public class Players { public void run() { PlayerResponse response = getAccount(name.toLowerCase()); if(response != null && response.getAccount() != null) { - playersCache.put(response.getAccount().getUsername(), response.getAccount()); + playersCache.put(response.getAccount().getUsername().toLowerCase(), response.getAccount()); } try { Thread.sleep(1000); From f829d0f217f220d62baa56caa02616588cbdf9bb Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Thu, 7 Dec 2023 19:56:33 +0600 Subject: [PATCH 3/3] Update Players.java --- src/main/java/net/silentclient/client/utils/Players.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/silentclient/client/utils/Players.java b/src/main/java/net/silentclient/client/utils/Players.java index 29bd1af..36052d1 100644 --- a/src/main/java/net/silentclient/client/utils/Players.java +++ b/src/main/java/net/silentclient/client/utils/Players.java @@ -9,12 +9,12 @@ import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt; import net.silentclient.client.utils.types.PlayerResponse; import org.json.JSONObject; +import java.util.HashMap; import java.util.Map; import java.util.UUID; -import java.util.WeakHashMap; public class Players { - public static final Map playersCache = new WeakHashMap<>(); + public static final Map playersCache = new HashMap<>(); public static boolean isLoading = false; public static void reload() {