diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index aea0867dd..f23beafa0 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -8,6 +8,7 @@ import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; @@ -42,7 +43,10 @@ import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -56,10 +60,13 @@ import mineplex.core.donation.DonationManager; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.logger.Logger; import mineplex.core.portal.Portal; +import mineplex.core.recharge.Recharge; import mineplex.core.stats.StatsManager; import mineplex.core.task.TaskManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.commands.ForcefieldToggle; +import mineplex.hub.commands.GadgetToggle; import mineplex.hub.gadget.GadgetManager; import mineplex.hub.modules.*; import mineplex.hub.mount.MountManager; @@ -102,6 +109,10 @@ public class HubManager extends MiniClientPlugin private int _slot = 7; private HashSet _disabled = new HashSet(); + + //Admin + private boolean _gadgetsEnabled = true; + private HashSet _forcefield = new HashSet(); public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager) { @@ -137,6 +148,13 @@ public class HubManager extends MiniClientPlugin ((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true; } + @Override + public void AddCommands() + { + AddCommand(new GadgetToggle(this)); + AddCommand(new ForcefieldToggle(this)); + } + @EventHandler(priority = EventPriority.HIGHEST) public void reflectMotd(ServerListPingEvent event) { @@ -771,6 +789,20 @@ public class HubManager extends MiniClientPlugin return UtilTime.elapsed(_portalTime.get(player.getName()), 5000); } + public boolean CanBump(LivingEntity ent) + { + if (!(ent instanceof Player)) + return true; + + if (BumpDisabled(ent)) + return false; + + if (GetVisibility().IsHiding(ent)) + return false; + + return true; + } + @EventHandler public void HeartDisplay(UpdateEvent event) { @@ -779,7 +811,7 @@ public class HubManager extends MiniClientPlugin for (Player player : UtilServer.getPlayers()) { - if (!player.isOp() && !player.getName().equals("MonsieurApple")) + if (!player.isOp()) continue; for (Player other : UtilServer.getPlayers()) @@ -810,4 +842,51 @@ public class HubManager extends MiniClientPlugin { event.SetCancelled(true); } + + public boolean IsGadgetEnabled() + { + return _gadgetsEnabled; + } + + public void SetGadgetEnabled(boolean _enabled) + { + this._gadgetsEnabled = _enabled; + } + + public boolean ToggleForcefield(Player caller) + { + if (_forcefield.add(caller)) + return true; + + _forcefield.remove(caller); + return false; + } + + @EventHandler + public void ForcefieldUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : _forcefield) + { + for (Player other : UtilServer.getPlayers()) + { + if (player.equals(other)) + continue; + + if (UtilMath.offset(other, player) > 5) + continue; + + if (GetClients().Get(other).GetRank().Has(Rank.ADMIN)) + continue; + + if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false)) + { + UtilAction.velocity(other, UtilAlg.getTrajectory2d(player, other), 1.6, true, 0.8, 0, 10, true); + other.getWorld().playSound(other.getLocation(), Sound.CHICKEN_EGG_POP, 2f, 0.5f); + } + } + } + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/ForcefieldToggle.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/ForcefieldToggle.java new file mode 100644 index 000000000..652351a8a --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/ForcefieldToggle.java @@ -0,0 +1,24 @@ +package mineplex.hub.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.hub.HubManager; + +public class ForcefieldToggle extends CommandBase +{ + public ForcefieldToggle(HubManager plugin) + { + super(plugin, Rank.ADMIN, new String[] {"forcefield", "ff"}); + } + + @Override + public void Execute(Player caller, String[] args) + { + UtilPlayer.message(caller, C.Bold + "Forcefield: " + F.tf(Plugin.ToggleForcefield(caller))); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GadgetToggle.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GadgetToggle.java new file mode 100644 index 000000000..32220b46a --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/GadgetToggle.java @@ -0,0 +1,33 @@ +package mineplex.hub.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.hub.HubManager; + +public class GadgetToggle extends CommandBase +{ + public GadgetToggle(HubManager plugin) + { + super(plugin, Rank.ADMIN, new String[] {"gadget"}); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.SetGadgetEnabled(!Plugin.IsGadgetEnabled()); + + //Disable + if (!Plugin.IsGadgetEnabled()) + { + Plugin.GetGadget().DisableAll(); + Plugin.GetMount().DisableAll(); + } + + UtilPlayer.message(caller, C.Bold + "Gadgets: " + F.tf(Plugin.IsGadgetEnabled())); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/GadgetManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/GadgetManager.java index 8b3dcf234..a8aee29c4 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/GadgetManager.java @@ -18,10 +18,14 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.MiniPlugin; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemStackFactory; import mineplex.hub.HubManager; +import mineplex.hub.commands.GadgetToggle; import mineplex.hub.gadget.gadgets.*; import mineplex.hub.gadget.types.ArmorGadget; import mineplex.hub.gadget.types.ArmorGadget.ArmorSlot; @@ -38,6 +42,8 @@ public class GadgetManager extends MiniPlugin private HashSet _gadgets; + + public GadgetManager(HubManager manager, MountManager mountManager) { super("Gadget Manager", manager.GetPlugin()); @@ -54,14 +60,14 @@ public class GadgetManager extends MiniPlugin _gadgets = new HashSet(); //Items - _gadgets.add(new PaintballGun(this)); + _gadgets.add(new GadgetPaintballGun(this)); //Helmet - _gadgets.add(new BlazeHelmet(this)); + _gadgets.add(new MorphBlaze(this)); //Halloween 2013 - _gadgets.add(new Halloween2013_BatGun(this)); - _gadgets.add(new Halloween2013_Helmet(this)); + _gadgets.add(new GadgetBatGun(this)); + _gadgets.add(new MorphPumpkinKing(this)); //Christmas 2013 //_gadgets.add(new Christmas2013_Helmet(this)); @@ -106,8 +112,16 @@ public class GadgetManager extends MiniPlugin { if (event.hasItem() && event.getItem().getType() == Material.CHEST) { - _gadgetShop.attemptShopOpen(event.getPlayer()); event.setCancelled(true); + + if (!Manager.IsGadgetEnabled()) + { + UtilPlayer.message(event.getPlayer(), F.main("Gadget", "Gadgets are currently disabled.")); + return; + } + + _gadgetShop.attemptShopOpen(event.getPlayer()); + } } @@ -188,4 +202,11 @@ public class GadgetManager extends MiniPlugin //No Portal Manager.SetPortalDelay(event.GetDamageeEntity()); } + + public void DisableAll() + { + for (Gadget gadget : _gadgets) + for (Player player : UtilServer.getPlayers()) + gadget.Disable(player); + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/Halloween2013_BatGun.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/GadgetBatGun.java similarity index 95% rename from Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/Halloween2013_BatGun.java rename to Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/GadgetBatGun.java index 9772a66a0..318cb7d24 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/Halloween2013_BatGun.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/GadgetBatGun.java @@ -31,13 +31,13 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.hub.gadget.GadgetManager; import mineplex.hub.gadget.types.ItemGadget; -public class Halloween2013_BatGun extends ItemGadget +public class GadgetBatGun extends ItemGadget { private HashMap _active = new HashMap(); private HashMap _velocity = new HashMap(); private HashMap> _bats = new HashMap>(); - public Halloween2013_BatGun(GadgetManager manager) + public GadgetBatGun(GadgetManager manager) { super(manager, "Bat Blaster", new String[] { @@ -49,7 +49,7 @@ public class Halloween2013_BatGun extends ItemGadget } @Override - public void Enable(Player player) + public void EnableCustom(Player player) { this.ApplyItem(player); } @@ -133,6 +133,9 @@ public class Halloween2013_BatGun extends ItemGadget if (other.equals(cur)) continue; + if (!Manager.Manager.CanBump(other)) + continue; + if (!Recharge.Instance.usable(other, "Hit by Bat")) continue; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/PaintballGun.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/GadgetPaintballGun.java similarity index 94% rename from Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/PaintballGun.java rename to Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/GadgetPaintballGun.java index b4d809240..c37454f32 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/PaintballGun.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/GadgetPaintballGun.java @@ -19,20 +19,18 @@ import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.hub.gadget.GadgetManager; import mineplex.hub.gadget.types.ItemGadget; -public class PaintballGun extends ItemGadget +public class GadgetPaintballGun extends ItemGadget { private HashSet _balls = new HashSet(); - public PaintballGun(GadgetManager manager) + public GadgetPaintballGun(GadgetManager manager) { super(manager, "Paintball Gun", new String[] { @@ -43,7 +41,7 @@ public class PaintballGun extends ItemGadget } @Override - public void Enable(Player player) + public void EnableCustom(Player player) { this.ApplyItem(player); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/BlazeHelmet.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphBlaze.java similarity index 93% rename from Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/BlazeHelmet.java rename to Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphBlaze.java index c92925c72..619c51a3e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/BlazeHelmet.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphBlaze.java @@ -2,7 +2,6 @@ package mineplex.hub.gadget.gadgets; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.entity.Horse; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; @@ -19,9 +18,9 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.hub.gadget.GadgetManager; import mineplex.hub.gadget.types.ArmorGadget; -public class BlazeHelmet extends ArmorGadget +public class MorphBlaze extends ArmorGadget { - public BlazeHelmet(GadgetManager manager) + public MorphBlaze(GadgetManager manager) { super(manager, "Blaze Helmet", new String[] { @@ -37,7 +36,7 @@ public class BlazeHelmet extends ArmorGadget } @Override - public void Enable(final Player player) + public void EnableCustom(final Player player) { this.ApplyArmor(player); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/Halloween2013_Helmet.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphPumpkinKing.java similarity index 90% rename from Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/Halloween2013_Helmet.java rename to Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphPumpkinKing.java index 8cfbd7a1a..be20d8a14 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/Halloween2013_Helmet.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphPumpkinKing.java @@ -10,9 +10,9 @@ import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.hub.gadget.GadgetManager; import mineplex.hub.gadget.types.ArmorGadget; -public class Halloween2013_Helmet extends ArmorGadget +public class MorphPumpkinKing extends ArmorGadget { - public Halloween2013_Helmet(GadgetManager manager) + public MorphPumpkinKing(GadgetManager manager) { super(manager, "Pumpkin Kings Head", new String[] { @@ -28,7 +28,7 @@ public class Halloween2013_Helmet extends ArmorGadget } @Override - public void Enable(final Player player) + public void EnableCustom(final Player player) { this.ApplyArmor(player); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/Christmas2013_Helmet.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphSnowman.java similarity index 83% rename from Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/Christmas2013_Helmet.java rename to Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphSnowman.java index 65f06b62a..a0eff8cdb 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/Christmas2013_Helmet.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphSnowman.java @@ -2,18 +2,15 @@ package mineplex.hub.gadget.gadgets; import org.bukkit.Material; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.EntityBlockFormEvent; -import org.bukkit.event.entity.EntityChangeBlockEvent; import mineplex.core.common.util.C; import mineplex.core.disguise.disguises.DisguiseSnowman; import mineplex.hub.gadget.GadgetManager; import mineplex.hub.gadget.types.ArmorGadget; -public class Christmas2013_Helmet extends ArmorGadget +public class MorphSnowman extends ArmorGadget { - public Christmas2013_Helmet(GadgetManager manager) + public MorphSnowman(GadgetManager manager) { super(manager, "Snowmans Head", new String[] { @@ -29,7 +26,7 @@ public class Christmas2013_Helmet extends ArmorGadget } @Override - public void Enable(final Player player) + public void EnableCustom(final Player player) { this.ApplyArmor(player); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/Gadget.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/Gadget.java index ed027c6ea..850d1b92f 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/Gadget.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/Gadget.java @@ -3,6 +3,8 @@ package mineplex.hub.gadget.types; import java.util.HashSet; import mineplex.core.common.CurrencyType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.shop.item.SalesPackageBase; import mineplex.hub.gadget.GadgetManager; @@ -44,7 +46,17 @@ public abstract class Gadget extends SalesPackageBase implements Listener Disable(event.getPlayer()); } - public abstract void Enable(Player player); + public final void Enable(Player player) + { + if (!Manager.Manager.IsGadgetEnabled()) + { + UtilPlayer.message(player, F.main("Gadget", "Gadgets are currently disabled.")); + return; + } + + EnableCustom(player); + } + public abstract void EnableCustom(Player player); public abstract void Disable(Player player); @Override diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index 8b0693e48..d1d9be26d 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -46,11 +46,8 @@ public class StackerManager extends MiniPlugin implements IThrown private ProjectileManager _projectileManager; - private HashSet _tempStackShift = new HashSet(); - - public StackerManager(HubManager manager) { super("Stacker", manager.GetPlugin()); @@ -60,26 +57,6 @@ public class StackerManager extends MiniPlugin implements IThrown _projectileManager = new ProjectileManager(manager.GetPlugin()); } - - - - - - - public boolean CanStack(LivingEntity ent) - { - if (!(ent instanceof Player)) - return true; - - if (Manager.BumpDisabled(ent)) - return false; - - if (Manager.GetVisibility().IsHiding(ent)) - return false; - - return true; - } - @EventHandler public void GrabEntity(PlayerInteractEntityEvent event) { @@ -101,7 +78,7 @@ public class StackerManager extends MiniPlugin implements IThrown return; } - if (!CanStack(stacker)) + if (!Manager.CanBump(stacker)) { UtilPlayer.message(stacker, F.main("Stacker", "You are not playing stacker.")); return; @@ -129,7 +106,7 @@ public class StackerManager extends MiniPlugin implements IThrown if (stackee instanceof Player && ((Player)stackee).getGameMode() != GameMode.SURVIVAL) return; - if (stackee instanceof Player && !CanStack(((Player)stackee))) + if (stackee instanceof Player && !Manager.CanBump(((Player)stackee))) { UtilPlayer.message(stacker, F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " is not playing stacker.")); return; @@ -246,6 +223,9 @@ public class StackerManager extends MiniPlugin implements IThrown if (target.getCustomName() != null || (target.getPassenger() != null && target.getPassenger() instanceof LivingEntity && ((LivingEntity)target.getPassenger()).getCustomName() != null)) return; + + if (!Manager.CanBump(target)) + return; //Velocity UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown(), target), 1, true, 0.8, 0, 10, true); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/DragonMount.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/DragonMount.java index c38d67c93..957c987f7 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/DragonMount.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/DragonMount.java @@ -18,7 +18,7 @@ public class DragonMount extends Mount } @Override - public void Enable(final Player player) + public void EnableCustom(final Player player) { player.leaveVehicle(); player.eject(); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/HorseMount.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/HorseMount.java index 0fdecf44a..595a6fead 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/HorseMount.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/HorseMount.java @@ -92,7 +92,7 @@ public class HorseMount extends Mount } } - public void Enable(Player player) + public void EnableCustom(Player player) { player.leaveVehicle(); player.eject(); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/Mount.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/Mount.java index 4fce2a407..ddc04afc1 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/Mount.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/Mount.java @@ -11,6 +11,8 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import mineplex.core.common.CurrencyType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.shop.item.SalesPackageBase; public abstract class Mount extends SalesPackageBase implements Listener @@ -32,8 +34,18 @@ public abstract class Mount extends SalesPackageBase implements Listener { } - - public abstract void Enable(Player player); + + public final void Enable(Player player) + { + if (!Manager.Manager.IsGadgetEnabled()) + { + UtilPlayer.message(player, F.main("Gadget", "Gadgets are currently disabled.")); + return; + } + + EnableCustom(player); + } + public abstract void EnableCustom(Player player); public abstract void Disable(Player player); @EventHandler diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/MountManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/MountManager.java index f870ab683..7f353058d 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/MountManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/MountManager.java @@ -14,6 +14,7 @@ import mineplex.core.MiniPlugin; import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.hub.HubManager; import mineplex.hub.mount.types.*; @@ -21,7 +22,7 @@ public class MountManager extends MiniPlugin { public HubManager Manager; - private HashSet _types; + private HashSet> _types; public MountManager(HubManager manager) { @@ -34,7 +35,7 @@ public class MountManager extends MiniPlugin private void CreateGadgets() { - _types = new HashSet(); + _types = new HashSet>(); _types.add(new Undead(this)); _types.add(new Frost(this)); @@ -42,7 +43,7 @@ public class MountManager extends MiniPlugin _types.add(new Dragon(this)); } - public HashSet getMounts() + public HashSet> getMounts() { return _types; } @@ -52,7 +53,7 @@ public class MountManager extends MiniPlugin { if (Manager.GetClients().Get(event.getPlayer()).GetRank().Has(Rank.MODERATOR)) { - for (Mount mount : _types) + for (Mount mount : _types) { Manager.GetDonation().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(mount.GetName()); } @@ -62,7 +63,7 @@ public class MountManager extends MiniPlugin //Disallows two mounts active public void DeregisterAll(Player player) { - for (Mount mount : _types) + for (Mount mount : _types) mount.Disable(player); } @@ -88,4 +89,11 @@ public class MountManager extends MiniPlugin if (event.getEntity().getItemStack().getType() == Material.LEASH) event.setCancelled(true); } + + public void DisableAll() + { + for (Mount mount : _types) + for (Player player : UtilServer.getPlayers()) + mount.Disable(player); + } }