Merge branch 'feature/dinnerbone-morph' of github.com:Mineplex-LLC/Minecraft-PC into feature/dinnerbone-morph

This commit is contained in:
LCastr0 2016-12-19 22:15:32 -02:00
commit fd223935c7
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

@ -61,7 +61,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);
};