Hub Commands (/forcefield and /gadget)
This commit is contained in:
parent
fbb0031dc1
commit
8c3deeba49
@ -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<HubClient>
|
||||
|
||||
private int _slot = 7;
|
||||
private HashSet<Player> _disabled = new HashSet<Player>();
|
||||
|
||||
//Admin
|
||||
private boolean _gadgetsEnabled = true;
|
||||
private HashSet<Player> _forcefield = new HashSet<Player>();
|
||||
|
||||
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<HubClient>
|
||||
((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<HubClient>
|
||||
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<HubClient>
|
||||
|
||||
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<HubClient>
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<HubManager>
|
||||
{
|
||||
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)));
|
||||
}
|
||||
}
|
@ -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<HubManager>
|
||||
{
|
||||
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()));
|
||||
}
|
||||
}
|
@ -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<Gadget> _gadgets;
|
||||
|
||||
|
||||
|
||||
public GadgetManager(HubManager manager, MountManager mountManager)
|
||||
{
|
||||
super("Gadget Manager", manager.GetPlugin());
|
||||
@ -54,14 +60,14 @@ public class GadgetManager extends MiniPlugin
|
||||
_gadgets = new HashSet<Gadget>();
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
@ -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<Player, Long> _active = new HashMap<Player, Long>();
|
||||
private HashMap<Player, Location> _velocity = new HashMap<Player, Location>();
|
||||
private HashMap<Player, ArrayList<Bat>> _bats = new HashMap<Player, ArrayList<Bat>>();
|
||||
|
||||
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;
|
||||
|
@ -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<Projectile> _balls = new HashSet<Projectile>();
|
||||
|
||||
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);
|
||||
}
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -46,11 +46,8 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
|
||||
private ProjectileManager _projectileManager;
|
||||
|
||||
|
||||
private HashSet<Entity> _tempStackShift = new HashSet<Entity>();
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
@ -18,7 +18,7 @@ public class DragonMount extends Mount<DragonData>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Enable(final Player player)
|
||||
public void EnableCustom(final Player player)
|
||||
{
|
||||
player.leaveVehicle();
|
||||
player.eject();
|
||||
|
@ -92,7 +92,7 @@ public class HorseMount extends Mount<Horse>
|
||||
}
|
||||
}
|
||||
|
||||
public void Enable(Player player)
|
||||
public void EnableCustom(Player player)
|
||||
{
|
||||
player.leaveVehicle();
|
||||
player.eject();
|
||||
|
@ -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<T> extends SalesPackageBase implements Listener
|
||||
@ -32,8 +34,18 @@ public abstract class Mount<T> 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
|
||||
|
@ -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<Mount> _types;
|
||||
private HashSet<Mount<?>> _types;
|
||||
|
||||
public MountManager(HubManager manager)
|
||||
{
|
||||
@ -34,7 +35,7 @@ public class MountManager extends MiniPlugin
|
||||
|
||||
private void CreateGadgets()
|
||||
{
|
||||
_types = new HashSet<Mount>();
|
||||
_types = new HashSet<Mount<?>>();
|
||||
|
||||
_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<Mount> getMounts()
|
||||
public HashSet<Mount<?>> 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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user