Merge pull request #83 from Silent-Client/PREMIUM2

Premium2
This commit is contained in:
kirillsaint 2023-12-07 20:16:59 +06:00 committed by GitHub
commit 0505a2886c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.network.NetHandlerPlayClient; 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.S19PacketEntityStatus;
import net.minecraft.network.play.server.S48PacketResourcePackSend; import net.minecraft.network.play.server.S48PacketResourcePackSend;
import net.minecraft.util.IChatComponent; 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") at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;displayGuiScreen(Lnet/minecraft/client/gui/GuiScreen;)V")
) )
private GuiScreen skipTerrainScreen(GuiScreen original) { private GuiScreen skipTerrainScreen(GuiScreen original) {
Players.reload();
return null; return null;
} }
@Inject(method = "handleJoinGame", at = @At(value = "RETURN"))
public void resetPlayers(S01PacketJoinGame packetIn, CallbackInfo ci) {
Players.reload();
}
//#if MC==10809 //#if MC==10809
@Inject(method = "handleResourcePack", at = @At("HEAD"), cancellable = true) @Inject(method = "handleResourcePack", at = @At("HEAD"), cancellable = true)
private void silent$resourceExploitFix(S48PacketResourcePackSend packetIn, CallbackInfo ci) { private void silent$resourceExploitFix(S48PacketResourcePackSend packetIn, CallbackInfo ci) {

View File

@ -9,15 +9,16 @@ import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
import net.silentclient.client.utils.types.PlayerResponse; import net.silentclient.client.utils.types.PlayerResponse;
import org.json.JSONObject; import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.WeakHashMap;
public class Players { public class Players {
public static final Map<String, PlayerResponse.Account> playersCache = new WeakHashMap<>(); public static final Map<String, PlayerResponse.Account> playersCache = new HashMap<>();
public static boolean isLoading = false; public static boolean isLoading = false;
public static void reload() { public static void reload() {
Client.logger.info("Clearing players cache");
playersCache.clear(); playersCache.clear();
} }
@ -101,7 +102,7 @@ public class Players {
public void run() { public void run() {
PlayerResponse response = getAccount(name.toLowerCase()); PlayerResponse response = getAccount(name.toLowerCase());
if(response != null && response.getAccount() != null) { if(response != null && response.getAccount() != null) {
playersCache.put(response.getAccount().getUsername(), response.getAccount()); playersCache.put(response.getAccount().getUsername().toLowerCase(), response.getAccount());
} }
try { try {
Thread.sleep(1000); Thread.sleep(1000);