From 81cfd559556f344d549ec5a8c485f6a5ade92eb6 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Thu, 7 Dec 2023 17:25:47 +0600 Subject: [PATCH] Update PlayerResponse.java --- .../client/utils/types/PlayerResponse.java | 63 +++++++++++++++---- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/src/main/java/net/silentclient/client/utils/types/PlayerResponse.java b/src/main/java/net/silentclient/client/utils/types/PlayerResponse.java index 4e4035e..0efb4f6 100644 --- a/src/main/java/net/silentclient/client/utils/types/PlayerResponse.java +++ b/src/main/java/net/silentclient/client/utils/types/PlayerResponse.java @@ -1,6 +1,9 @@ package net.silentclient.client.utils.types; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; import net.silentclient.client.Client; +import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt; import net.silentclient.client.utils.NotificationUtils; import net.silentclient.client.utils.Players; import net.silentclient.client.utils.Requests; @@ -99,7 +102,10 @@ public class PlayerResponse extends AbstractReply { } public void updateFavorite(int id, String type) { - Players.handleAccount(this); + Players.reload(); + if(Minecraft.getMinecraft().thePlayer != null) { + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + } (new Thread("updateFavorite") { public void run() { Requests.post("https://api.silentclient.net/account/update_favorite_cosmetics", new JSONObject().put("id", id).put("type", type).toString()); @@ -110,7 +116,10 @@ public class PlayerResponse extends AbstractReply { public void setBandanaColor(int color) { this.bandana_color = color; - Players.handleAccount(this); + Players.reload(); + if(Minecraft.getMinecraft().thePlayer != null) { + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + } (new Thread() { public void run() { Requests.post("https://api.silentclient.net/plus/set_bandana_color", new JSONObject().put("color", color).toString()); @@ -154,7 +163,10 @@ public class PlayerResponse extends AbstractReply { public void setShowNametagMessage(boolean show) { this.show_nametag_message = show ? 1 : 0; Players.reload(); - Players.handleAccount(this); + Players.reload(); + if(Minecraft.getMinecraft().thePlayer != null) { + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + } (new Thread("setShowNametagMessage") { public void run() { Requests.post("https://api.silentclient.net/plus/set_nametag_message", new JSONObject().put("enabled", show).toString()); @@ -166,7 +178,10 @@ public class PlayerResponse extends AbstractReply { public void setNametagMessage(String message) { this.nametag_message = message; Players.reload(); - Players.handleAccount(this); + Players.reload(); + if(Minecraft.getMinecraft().thePlayer != null) { + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + } String response = Requests.post("https://api.silentclient.net/plus/set_nametag_message", new JSONObject().put("message", message).toString()); if(response != null) { NotificationUtils.showNotification("success", "Nametag Message updated successfully!"); @@ -182,7 +197,10 @@ public class PlayerResponse extends AbstractReply { public void setCapeShoulders(boolean shoulders) { this.cape_shoulders = shoulders ? 1 : 0; - Players.handleAccount(this); + Players.reload(); + if(Minecraft.getMinecraft().thePlayer != null) { + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + } (new Thread("setShoulders") { public void run() { Requests.post("https://api.silentclient.net/account/set_cape_shoulders", new JSONObject().put("enabled", shoulders).toString()); @@ -195,7 +213,10 @@ public class PlayerResponse extends AbstractReply { public void setCapeType(String type) { this.cape_type = type; - Players.handleAccount(this); + Players.reload(); + if(Minecraft.getMinecraft().thePlayer != null) { + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + } (new Thread("setCapeType") { public void run() { Requests.post("https://api.silentclient.net/account/set_cape_type", new JSONObject().put("type", type).toString()); @@ -287,7 +308,10 @@ public class PlayerResponse extends AbstractReply { public void setSelectedBandana(int id) { final int bandanaId = id == this.selected_bandana ? 0 : id; this.selected_bandana = bandanaId; - Players.handleAccount(this); + Players.reload(); + if(Minecraft.getMinecraft().thePlayer != null) { + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + } (new Thread("setBandana") { public void run() { Requests.post("https://api.silentclient.net/account/select_bandana", new JSONObject().put("id", bandanaId).toString()); @@ -314,7 +338,10 @@ public class PlayerResponse extends AbstractReply { break; } final int cid = hatId; - Players.handleAccount(this); + Players.reload(); + if(Minecraft.getMinecraft().thePlayer != null) { + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + } (new Thread("setHat") { public void run() { Requests.post("https://api.silentclient.net/account/select_hat", new JSONObject().put("id", cid).put("type", type).toString()); @@ -327,7 +354,10 @@ public class PlayerResponse extends AbstractReply { public void setSelectedShield(int id) { final int hatId = id == this.selected_shield ? 0 : id; this.selected_shield = hatId; - Players.handleAccount(this); + Players.reload(); + if(Minecraft.getMinecraft().thePlayer != null) { + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + } (new Thread("setShield") { public void run() { Requests.post("https://api.silentclient.net/account/select_shield", new JSONObject().put("id", hatId).toString()); @@ -344,7 +374,10 @@ public class PlayerResponse extends AbstractReply { public void setSelectedCape(int id) { final int capeId = id == this.selected_cape ? 0 : id; this.selected_cape = capeId; - Players.handleAccount(this); + Players.reload(); + if(Minecraft.getMinecraft().thePlayer != null) { + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + } (new Thread("setCapeRequest") { public void run() { Requests.post("https://api.silentclient.net/account/select_cape", new JSONObject().put("id", capeId).toString()); @@ -361,7 +394,10 @@ public class PlayerResponse extends AbstractReply { public void setSelectedWings(int id) { final int wingsId = id == this.selected_wings ? 0 : id; this.selected_wings = wingsId; - Players.handleAccount(this); + Players.reload(); + if(Minecraft.getMinecraft().thePlayer != null) { + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + } (new Thread("setWingsRequest") { public void run() { Requests.post("https://api.silentclient.net/account/select_wings", new JSONObject().put("id", wingsId).toString()); @@ -378,7 +414,10 @@ public class PlayerResponse extends AbstractReply { public void setSelectedIcon(int id) { final int iconId = id == this.selected_icon ? 0 : id; this.selected_icon = iconId; - Players.handleAccount(this); + Players.reload(); + if(Minecraft.getMinecraft().thePlayer != null) { + Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); + } (new Thread("setIconRequest") { public void run() { Requests.post("https://api.silentclient.net/account/select_icon", new JSONObject().put("id", iconId).toString());