Update PlayerResponse.java

This commit is contained in:
kirillsaint 2023-12-07 17:25:47 +06:00
parent c52c6e4624
commit 81cfd55955

View File

@ -1,6 +1,9 @@
package net.silentclient.client.utils.types; 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.Client;
import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
import net.silentclient.client.utils.NotificationUtils; import net.silentclient.client.utils.NotificationUtils;
import net.silentclient.client.utils.Players; import net.silentclient.client.utils.Players;
import net.silentclient.client.utils.Requests; import net.silentclient.client.utils.Requests;
@ -99,7 +102,10 @@ public class PlayerResponse extends AbstractReply {
} }
public void updateFavorite(int id, String type) { 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") { (new Thread("updateFavorite") {
public void run() { public void run() {
Requests.post("https://api.silentclient.net/account/update_favorite_cosmetics", new JSONObject().put("id", id).put("type", type).toString()); 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) { public void setBandanaColor(int color) {
this.bandana_color = 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() { (new Thread() {
public void run() { public void run() {
Requests.post("https://api.silentclient.net/plus/set_bandana_color", new JSONObject().put("color", color).toString()); 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) { public void setShowNametagMessage(boolean show) {
this.show_nametag_message = show ? 1 : 0; this.show_nametag_message = show ? 1 : 0;
Players.reload(); 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") { (new Thread("setShowNametagMessage") {
public void run() { public void run() {
Requests.post("https://api.silentclient.net/plus/set_nametag_message", new JSONObject().put("enabled", show).toString()); 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) { public void setNametagMessage(String message) {
this.nametag_message = message; this.nametag_message = message;
Players.reload(); 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()); String response = Requests.post("https://api.silentclient.net/plus/set_nametag_message", new JSONObject().put("message", message).toString());
if(response != null) { if(response != null) {
NotificationUtils.showNotification("success", "Nametag Message updated successfully!"); NotificationUtils.showNotification("success", "Nametag Message updated successfully!");
@ -182,7 +197,10 @@ public class PlayerResponse extends AbstractReply {
public void setCapeShoulders(boolean shoulders) { public void setCapeShoulders(boolean shoulders) {
this.cape_shoulders = shoulders ? 1 : 0; 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") { (new Thread("setShoulders") {
public void run() { public void run() {
Requests.post("https://api.silentclient.net/account/set_cape_shoulders", new JSONObject().put("enabled", shoulders).toString()); 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) { public void setCapeType(String type) {
this.cape_type = 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") { (new Thread("setCapeType") {
public void run() { public void run() {
Requests.post("https://api.silentclient.net/account/set_cape_type", new JSONObject().put("type", type).toString()); 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) { public void setSelectedBandana(int id) {
final int bandanaId = id == this.selected_bandana ? 0 : id; final int bandanaId = id == this.selected_bandana ? 0 : id;
this.selected_bandana = bandanaId; 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") { (new Thread("setBandana") {
public void run() { public void run() {
Requests.post("https://api.silentclient.net/account/select_bandana", new JSONObject().put("id", bandanaId).toString()); 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; break;
} }
final int cid = hatId; 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") { (new Thread("setHat") {
public void run() { public void run() {
Requests.post("https://api.silentclient.net/account/select_hat", new JSONObject().put("id", cid).put("type", type).toString()); 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) { public void setSelectedShield(int id) {
final int hatId = id == this.selected_shield ? 0 : id; final int hatId = id == this.selected_shield ? 0 : id;
this.selected_shield = hatId; 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") { (new Thread("setShield") {
public void run() { public void run() {
Requests.post("https://api.silentclient.net/account/select_shield", new JSONObject().put("id", hatId).toString()); 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) { public void setSelectedCape(int id) {
final int capeId = id == this.selected_cape ? 0 : id; final int capeId = id == this.selected_cape ? 0 : id;
this.selected_cape = capeId; 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") { (new Thread("setCapeRequest") {
public void run() { public void run() {
Requests.post("https://api.silentclient.net/account/select_cape", new JSONObject().put("id", capeId).toString()); 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) { public void setSelectedWings(int id) {
final int wingsId = id == this.selected_wings ? 0 : id; final int wingsId = id == this.selected_wings ? 0 : id;
this.selected_wings = wingsId; 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") { (new Thread("setWingsRequest") {
public void run() { public void run() {
Requests.post("https://api.silentclient.net/account/select_wings", new JSONObject().put("id", wingsId).toString()); 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) { public void setSelectedIcon(int id) {
final int iconId = id == this.selected_icon ? 0 : id; final int iconId = id == this.selected_icon ? 0 : id;
this.selected_icon = iconId; 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") { (new Thread("setIconRequest") {
public void run() { public void run() {
Requests.post("https://api.silentclient.net/account/select_icon", new JSONObject().put("id", iconId).toString()); Requests.post("https://api.silentclient.net/account/select_icon", new JSONObject().put("id", iconId).toString());