Fixed taunts not being disabled correctly

This commit is contained in:
LCastr0 2017-03-04 14:07:24 -03:00
parent 85b5eee92f
commit f9b66e28f4
3 changed files with 15 additions and 11 deletions

View File

@ -29,7 +29,7 @@ public class TauntPage extends GadgetPage
@Override @Override
protected void buildPage() protected void buildPage()
{ {
int slot = 10; int slot = 10;
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.TAUNT); List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.TAUNT);
if(list != null) if(list != null)
@ -37,8 +37,10 @@ public class TauntPage extends GadgetPage
{ {
addGadget(gadget, slot); addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.TAUNT) == gadget) if (gadget.isActive(getPlayer()))
addGlow(slot); {
addGlow(slot);
}
slot++; slot++;

View File

@ -2,8 +2,10 @@ package mineplex.core.gadget;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.function.Predicate; import java.util.function.Predicate;
@ -28,7 +30,6 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.AchievementManager;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -256,10 +257,10 @@ public class GadgetManager extends MiniPlugin
private TreasureManager _treasureManager; private TreasureManager _treasureManager;
private SoulManager _soulManager; private SoulManager _soulManager;
private NautHashMap<GadgetType, List<Gadget>> _gadgets; private Map<GadgetType, List<Gadget>> _gadgets;
private final NautHashMap<Player, Long> _lastMove = new NautHashMap<>(); private final Map<Player, Long> _lastMove = new HashMap<>();
private final NautHashMap<Player, NautHashMap<GadgetType, Gadget>> _playerActiveGadgetMap = new NautHashMap<>(); private final Map<Player, Map<GadgetType, Gadget>> _playerActiveGadgetMap = new HashMap<>();
private final HashSet<GadgetSet> _sets = new HashSet<>(); private final HashSet<GadgetSet> _sets = new HashSet<>();
@ -336,7 +337,7 @@ public class GadgetManager extends MiniPlugin
private void createGadgets() private void createGadgets()
{ {
_gadgets = new NautHashMap<>(); _gadgets = new HashMap<>();
// Items // Items
addGadget(new ItemEtherealPearl(this)); addGadget(new ItemEtherealPearl(this));
@ -1040,7 +1041,7 @@ public class GadgetManager extends MiniPlugin
public void setActive(Player player, Gadget gadget) public void setActive(Player player, Gadget gadget)
{ {
if (!_playerActiveGadgetMap.containsKey(player)) if (!_playerActiveGadgetMap.containsKey(player))
_playerActiveGadgetMap.put(player, new NautHashMap<GadgetType, Gadget>()); _playerActiveGadgetMap.put(player, new HashMap<>());
_playerActiveGadgetMap.get(player).put(gadget.getGadgetType(), gadget); _playerActiveGadgetMap.get(player).put(gadget.getGadgetType(), gadget);
} }
@ -1048,7 +1049,7 @@ public class GadgetManager extends MiniPlugin
public Gadget getActive(Player player, GadgetType gadgetType) public Gadget getActive(Player player, GadgetType gadgetType)
{ {
if (!_playerActiveGadgetMap.containsKey(player)) if (!_playerActiveGadgetMap.containsKey(player))
_playerActiveGadgetMap.put(player, new NautHashMap<GadgetType, Gadget>()); _playerActiveGadgetMap.put(player, new HashMap<>());
return _playerActiveGadgetMap.get(player).get(gadgetType); return _playerActiveGadgetMap.get(player).get(gadgetType);
} }
@ -1056,7 +1057,7 @@ public class GadgetManager extends MiniPlugin
public void removeActive(Player player, Gadget gadget) public void removeActive(Player player, Gadget gadget)
{ {
if (!_playerActiveGadgetMap.containsKey(player)) if (!_playerActiveGadgetMap.containsKey(player))
_playerActiveGadgetMap.put(player, new NautHashMap<GadgetType, Gadget>()); _playerActiveGadgetMap.put(player, new HashMap<>());
_playerActiveGadgetMap.get(player).remove(gadget.getGadgetType()); _playerActiveGadgetMap.get(player).remove(gadget.getGadgetType());
} }

View File

@ -70,6 +70,7 @@ public abstract class TauntGadget extends Gadget
@Override @Override
public void disableCustom(Player player, boolean message) public void disableCustom(Player player, boolean message)
{ {
super.disableCustom(player, message);
finish(player); finish(player);
} }