Disallow eternal taunt disguising an already disguised player

This commit is contained in:
Graphica 2017-06-28 01:37:06 -04:00 committed by cnr
parent 5387d3b580
commit ea8c7be5f0

View File

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import mineplex.core.disguise.disguises.DisguiseBase;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
@ -41,7 +42,8 @@ public class EternalTaunt extends TauntGadget
private static final int COOLDOWN = 30000;
private static final int PVP_COOLDOWN = 10000;
private Map<UUID, List<Item>> _clocks = new HashMap<>();
private final Map<UUID, List<Item>> _clocks = new HashMap<>();
private final Map<UUID, DisguiseBase> _disguises = new HashMap<>();
public EternalTaunt(GadgetManager manager)
{
@ -68,8 +70,12 @@ public class EternalTaunt extends TauntGadget
Bukkit.broadcastMessage(F.main("Taunt", F.name(player.getName()) + " waited so long they turned to bones."));
DisguiseSkeleton disguiseSkeleton = new DisguiseSkeleton(player);
UtilMorph.disguise(player, disguiseSkeleton, Manager);
if (!Manager.getDisguiseManager().isDisguised(player))
{
DisguiseSkeleton disguiseSkeleton = new DisguiseSkeleton(player);
UtilMorph.disguise(player, disguiseSkeleton, Manager);
_disguises.put(player.getUniqueId(), disguiseSkeleton);
}
}
@Override
@ -114,7 +120,11 @@ public class EternalTaunt extends TauntGadget
@Override
public void onFinish(Player player)
{
UtilMorph.undisguise(player, Manager.getDisguiseManager());
if (_disguises.containsKey(player.getUniqueId()))
{
Manager.getDisguiseManager().undisguise(_disguises.remove(player.getUniqueId()));
}
if (_clocks.containsKey(player.getUniqueId()))
{
_clocks.get(player.getUniqueId()).forEach(c -> c.remove());