Skip to content

Commit

Permalink
[Layout] If trying to use skin of an online player in fixed slot, try…
Browse files Browse the repository at this point in the history
… to get it from the player's profile if online
  • Loading branch information
NEZNAMY committed Jan 19, 2025
1 parent 9cb2f27 commit e9dfcde
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import me.neznamy.tab.shared.TAB;
import me.neznamy.tab.shared.config.file.ConfigurationFile;
import me.neznamy.tab.shared.platform.TabList.Skin;
import me.neznamy.tab.shared.platform.TabPlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.simple.JSONObject;
Expand All @@ -24,6 +25,14 @@ protected PlayerSkin(@NotNull ConfigurationFile file) {
@Nullable
public Skin download(@NotNull String input) {
try {
TabPlayer player = TAB.getInstance().getPlayer(input);
if (player != null) {
Skin skin = player.getSkin();
if (skin != null) {
TAB.getInstance().debug("Skipping downloading of PLAYER skin " + input + ", because such player is online. Taking skin from their profile instead.");
return skin;
}
}
long time = System.currentTimeMillis();
JSONObject json = getResponse("https://api.ashcon.app/mojang/v2/user/" + input);
JSONObject textures = (JSONObject) json.get("textures");
Expand Down

0 comments on commit e9dfcde

Please sign in to comment.