Fix not updating skin/tab list

This commit is contained in:
samczsun 2016-12-19 19:14:28 -05:00
parent eadbb22de9
commit b85bd623f7
3 changed files with 29 additions and 10 deletions

View File

@ -532,14 +532,25 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
{
if (!pDisguise.replaceOriginalName())
{
PacketPlayOutPlayerInfo playerInfoPacketRemove = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER);
PacketPlayOutPlayerInfo.PlayerInfoData dataRemove = playerInfoPacketRemove.new PlayerInfoData(pDisguise.getProfile(), 0, WorldSettings.EnumGamemode.SURVIVAL, null);
playerInfoPacketRemove.b.add(dataRemove);
handlePacket(playerInfoPacketRemove, packetVerifier);
PacketPlayOutPlayerInfo playerInfoPacketAdd = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER);
PacketPlayOutPlayerInfo.PlayerInfoData dataAdd = playerInfoPacketRemove.new PlayerInfoData(pDisguise.getOriginalProfile(), 0, WorldSettings.EnumGamemode.SURVIVAL, null);
playerInfoPacketAdd.b.add(dataAdd);
handlePacket(playerInfoPacketAdd, packetVerifier);
Runnable r = () ->
{
PacketPlayOutPlayerInfo playerInfoPacketRemove = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER);
PacketPlayOutPlayerInfo.PlayerInfoData dataRemove = playerInfoPacketRemove.new PlayerInfoData(pDisguise.getProfile(), 0, WorldSettings.EnumGamemode.SURVIVAL, null);
playerInfoPacketRemove.b.add(dataRemove);
handlePacket(playerInfoPacketRemove, packetVerifier);
PacketPlayOutPlayerInfo playerInfoPacketAdd = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER);
PacketPlayOutPlayerInfo.PlayerInfoData dataAdd = playerInfoPacketRemove.new PlayerInfoData(pDisguise.getOriginalProfile(), 0, WorldSettings.EnumGamemode.SURVIVAL, null);
playerInfoPacketAdd.b.add(dataAdd);
handlePacket(playerInfoPacketAdd, packetVerifier);
};
if (pDisguise.replaceOriginalNameDelay() == 0)
{
r.run();
}
else
{
Bukkit.getScheduler().runTaskLater(UtilServer.getPlugin(), r, pDisguise.replaceOriginalNameDelay());
}
}
}
}

View File

@ -62,6 +62,7 @@ public class DisguisePlayer extends DisguiseHuman
private boolean _showInTabList = false;
private boolean _replaceOriginalName = true;
private int _showInTabListDelay = 30;
private int _replaceOriginalNameDelay;
private DisguisePlayer(Entity entity)
{
@ -464,9 +465,15 @@ public class DisguisePlayer extends DisguiseHuman
return this._replaceOriginalName;
}
public void setReplaceOriginalName(boolean b)
public int replaceOriginalNameDelay()
{
return this._replaceOriginalNameDelay;
}
public void setReplaceOriginalName(boolean b, int delay)
{
this._replaceOriginalName = b;
this._replaceOriginalNameDelay = delay;
}
private UUID getOriginalUUID()

View File

@ -59,7 +59,8 @@ public class MorphDinnerbone extends MorphGadget
requestedProfile.getProperties().put("textures", skinData.getProperty());
DisguisePlayer disguisePlayer = new DisguisePlayer(player, requestedProfile);
disguisePlayer.setReplaceOriginalName(false);
disguisePlayer.setSendSkinDataToSelf(false);
disguisePlayer.setReplaceOriginalName(false, 5);
disguisePlayer.showInTabList(true, 0);
UtilMorph.disguise(player, disguisePlayer, Manager);
};