Merge branch 'project-cosmetics' into develop

This commit is contained in:
cnr 2016-07-13 21:22:41 -05:00
commit 4343fa3512
2 changed files with 13 additions and 3 deletions

View File

@ -671,7 +671,7 @@ public class GadgetManager extends MiniPlugin
} }
for (Gadget gadget : _gadgets.get(gadgetType)) for (Gadget gadget : _gadgets.get(gadgetType))
{ {
gadget.disable(player); gadget.disable(player, false);
} }
} }
} }

View File

@ -123,13 +123,18 @@ public abstract class Gadget extends SalesPackageBase implements Listener
} }
public void disable(Player player) public void disable(Player player)
{
disable(player, true);
}
public void disable(Player player, boolean message)
{ {
if (isActive(player)) if (isActive(player))
{ {
Manager.removeActive(player, this); Manager.removeActive(player, this);
GadgetDisableEvent event = new GadgetDisableEvent(player, this); GadgetDisableEvent event = new GadgetDisableEvent(player, this);
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
disableCustom(player); disableCustom(player, message);
} }
} }
@ -143,7 +148,12 @@ public abstract class Gadget extends SalesPackageBase implements Listener
public void disableCustom(Player player) public void disableCustom(Player player)
{ {
if (_active.remove(player)) disableCustom(player, true);
}
public void disableCustom(Player player, boolean message)
{
if (_active.remove(player) && message)
UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(getName()) + ".")); UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(getName()) + "."));
} }