我正在编写一个bukkit插件,该插件应该能够向玩家发送GameProfile更新以更改玩家的皮肤。但它表示在游戏机中,皮肤签名无效。如何获得有效的皮肤签名?
/**
* Sets the skin of a player
* @param p The player
* @param fn The file name on the server
*/
public void setSkin(Player p, String fn){
GameProfile gp = ((CraftPlayer)p).getProfile();
String skin = new String(Base64.encodeBase64(("{\"timestamp\":1503497691710,\"profileId\":\"b4be22fdb7004478839c787357d78cbe\",\"profileName\":\"Colinus999\",\"signatureRequired\":false,\"textures\":{\"SKIN\":{\"url\":\"http://colintimbarndt.de/skin/"+fn+"\"}}}").getBytes()));
String sig = "kVWGmfZuMbHc0KhDjX0FrdNA4KK/JTFiSDUQu5O1Jw76/Y+ozfsxZUNkljzCke3cEhpTCdgZuy0nEaBI7WhdunacxBcm7r//a1W/Z5MBJKt3KZM8lySzHlUaM1cSIwRZIrGz5PDcqbgxm/GmOEiewehn6M5vEIBOoYwmCBNpYswVkIG/2qmcHsXUG3zzvzoYdTuKZuBHdGhWHr14TI19deW/Mqru2Bmc+bK1FrGrnT0urUiDIsDbjWXGdOYkci7vMPutlFHDHbFu0+HDalIpeRjI3IiVnwHPim9zu+fkYN92pAyAQeTa2AwmHTMO6/JY/o539HAvYbDcovMzXXZxzPWlozhw3ib+z+OwvsOuBcwPCeN1zhiUYQJFm5lR8d2IvwbNe2y40NWQm0oBI71rneNw2h5TH54muqLRJ297Sli35Ufs0z79I3gn5XTtfiSLFTicZzQ61Nq8CmcXKi4Q/eytHpPkmoNibPsr6BUJd6BI2XDg2YQzdBvpQcjd6azkuQL95arOdlk1UaBMIZwU5/yHaNfiG0Q7+fHTbIXchIHtdr668ly6S0CqOKmvztmcHYlUqV73WBB7GmoZS0tKz8cmMc1hmlvkh+DZ8BQ+EGBu6pYZE6NQ8x+Vv69XIeLUCR3c/JIQ69uGIUwPWa6ainNp//aSUVULsxVS6g3Iwi8=";
gp.getProperties().clear();
gp.getProperties().put("textures", new Property("textures", skin, sig));
gp.getProperties().put("Colinus999", new Property("textures", skin, sig));
// Update the player
for(Player p1 : lobby.getWorld().getPlayers()){
p1.hidePlayer(p);
}
Bukkit.getScheduler().scheduleSyncDelayedTask(Plugin.plugin, new Runnable() {
public void run(){
for(Player p1 : lobby.getWorld().getPlayers()){
p1.showPlayer(p);
}
}
}, 5);
}
通过打开以下链接,我得到了签名和其他数据:
https://sessionserver.mojang.com/session/minecraft/profile/b4be22fdb7004478839c787357d78cbe?unsigned=false
有关播放器皮肤的更多信息:https://minecraft.gamepedia.com/Player.dat_format#Player_Heads
我知道这是可能的,因为有些服务器可以改变玩家的皮肤甚至进行编辑。
最佳答案
我修好了它!
我必须为每个皮肤保存json! (至少签名和皮肤数据)
您不需要任何服务器等。
关于java - Bukkit将播放器皮肤从服务器更改为png(无效签名),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45843527/