diff --git a/galaxy/src/main/java/com/alttd/chat/chat_web/handlers/WebUpdatePlayerList.java b/galaxy/src/main/java/com/alttd/chat/chat_web/handlers/WebUpdatePlayerList.java index 6b49932..01129db 100644 --- a/galaxy/src/main/java/com/alttd/chat/chat_web/handlers/WebUpdatePlayerList.java +++ b/galaxy/src/main/java/com/alttd/chat/chat_web/handlers/WebUpdatePlayerList.java @@ -9,10 +9,8 @@ import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolManager; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.reflect.StructureModifier; -import com.comphenix.protocol.wrappers.EnumWrappers; -import com.comphenix.protocol.wrappers.PlayerInfoData; -import com.comphenix.protocol.wrappers.WrappedChatComponent; -import com.comphenix.protocol.wrappers.WrappedGameProfile; +import com.comphenix.protocol.wrappers.*; +import com.destroystokyo.paper.profile.PlayerProfile; import lombok.extern.slf4j.Slf4j; import me.neznamy.tab.api.TabAPI; import me.neznamy.tab.api.TabPlayer; @@ -21,6 +19,8 @@ import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import org.jspecify.annotations.NonNull; +import java.net.URL; +import java.nio.charset.StandardCharsets; import java.util.*; @Slf4j @@ -141,6 +141,31 @@ public final class WebUpdatePlayerList implements WebHandler { fakePlayer.name() ); + OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(fakePlayer.uuid()); + PlayerProfile playerProfile = offlinePlayer.getPlayerProfile(); + + URL skinUrl = playerProfile.getTextures().getSkin(); + + if (skinUrl != null) { + String textureJson = """ + { + "textures": { + "SKIN": { + "url": "%s" + } + } + } + """.formatted(skinUrl); + + String textureValue = Base64.getEncoder() + .encodeToString(textureJson.getBytes(StandardCharsets.UTF_8)); + + profile.getProperties().put( + "textures", + new WrappedSignedProperty("textures", textureValue, null) + ); + } + PlayerInfoData data = new PlayerInfoData( fakePlayer.uuid(), 0,