Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-08-22 13:32:50 -05:00
commit b67b2f04b7
50 changed files with 1381 additions and 78 deletions

View File

@ -17,6 +17,7 @@ import me.chiss.Core.Plugin.IRelation;
import me.chiss.Core.Server.Server;
import mineplex.core.account.CoreClientManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.minecraft.core.condition.ConditionManager;
import mineplex.core.creature.Creature;
import mineplex.core.energy.Energy;
import mineplex.core.explosion.Explosion;
@ -25,7 +26,6 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.server.IRepository;
import mineplex.core.spawn.Spawn;
import mineplex.core.teleport.Teleport;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.fire.Fire;
import mineplex.minecraft.game.core.mechanics.Weapon;

View File

@ -73,5 +73,13 @@ public class UtilMath
{
return a.distanceSquared(b);
}
public static double rr(double d, boolean bidirectional)
{
if (bidirectional)
return Math.random() * (2 * d) - d;
return Math.random() * d;
}
}

View File

@ -0,0 +1,46 @@
package mineplex.core.event;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class StackerEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Entity _entity;
private boolean _cancelled = false;
public StackerEvent(Entity entity)
{
_entity = entity;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public Entity getEntity()
{
return _entity;
}
public void setCancelled(boolean cancel)
{
_cancelled = cancel;
}
public boolean isCancelled()
{
return _cancelled;
}
}

View File

@ -34,6 +34,7 @@ import mineplex.core.inventory.InventoryManager;
import mineplex.core.mount.MountManager;
import mineplex.core.pet.PetManager;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
public class GadgetManager extends MiniPlugin
{
@ -44,6 +45,7 @@ public class GadgetManager extends MiniPlugin
private PreferencesManager _preferencesManager;
private DisguiseManager _disguiseManager;
private BlockRestore _blockRestore;
private ProjectileManager _projectileManager;
private NautHashMap<GadgetType, List<Gadget>> _gadgets;
@ -55,7 +57,7 @@ public class GadgetManager extends MiniPlugin
public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager,
MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager,
DisguiseManager disguiseManager, BlockRestore blockRestore)
DisguiseManager disguiseManager, BlockRestore blockRestore, ProjectileManager projectileManager)
{
super("Gadget Manager", plugin);
@ -66,6 +68,7 @@ public class GadgetManager extends MiniPlugin
_preferencesManager = preferencesManager;
_disguiseManager = disguiseManager;
_blockRestore = blockRestore;
_projectileManager = projectileManager;
CreateGadgets();
}
@ -81,6 +84,8 @@ public class GadgetManager extends MiniPlugin
addGadget(new ItemCoinBomb(this));
addGadget(new ItemFirework(this));
addGadget(new ItemTNT(this));
addGadget(new ItemFleshHook(this));
addGadget(new ItemMelonLauncher(this));
// Morphs
addGadget(new MorphBlaze(this));
@ -88,6 +93,8 @@ public class GadgetManager extends MiniPlugin
addGadget(new MorphCreeper(this));
addGadget(new MorphChicken(this));
addGadget(new MorphPig(this));
addGadget(new MorphBat(this));
addGadget(new MorphBlock(this));
// Particles
addGadget(new ParticleGreen(this));
@ -243,6 +250,11 @@ public class GadgetManager extends MiniPlugin
return _preferencesManager;
}
public ProjectileManager getProjectileManager()
{
return _projectileManager;
}
public DisguiseManager getDisguiseManager()
{
return _disguiseManager;

View File

@ -0,0 +1,246 @@
package mineplex.core.gadget.gadgets;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguiseCat;
import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class BlockForm
{
public MorphBlock Host;
public Player Player;
private Material _mat;
private Block _block;
private Location _loc;
public BlockForm(MorphBlock host, Player player, Material mat)
{
Host = host;
Player = player;
_mat = mat;
_loc = player.getLocation();
Apply();
}
public void Apply()
{
//Remove Old
if (Player.getPassenger() != null)
{
Recharge.Instance.useForce(Player, "PassengerChange", 100);
Player.getPassenger().remove();
Player.eject();
}
((CraftEntity)Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32));
//Player > Chicken
DisguiseChicken disguise = new DisguiseChicken(Player);
disguise.setBaby();
disguise.setSoundDisguise(new DisguiseCat(Player));
Host.Manager.getDisguiseManager().disguise(disguise);
//Apply Falling Block
FallingBlockCheck();
//Inform
String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false));
if (!blockName.contains("Block"))
UtilPlayer.message(Player, F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false) + " Block") + "!"));
else
UtilPlayer.message(Player, F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false)) + "!"));
//Sound
Player.playSound(Player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
public void Remove()
{
SolidifyRemove();
Host.Manager.getDisguiseManager().undisguise(Player);
//Remove FB
if (Player.getPassenger() != null)
{
Recharge.Instance.useForce(Player, "PassengerChange", 100);
Player.getPassenger().remove();
Player.eject();
}
((CraftEntity)Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0));
}
public void SolidifyUpdate()
{
if (!Player.isSprinting())
((CraftEntity)Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32));
//Not a Block
if (_block == null)
{
//Moved
if (!_loc.getBlock().equals(Player.getLocation().getBlock()))
{
Player.setExp(0);
_loc = Player.getLocation();
}
//Unmoved
else
{
double hideBoost = 0.025;
Player.setExp((float) Math.min(0.999f, Player.getExp() + hideBoost));
//Set Block
if (Player.getExp() >= 0.999f)
{
Block block = Player.getLocation().getBlock();
//Not Able
if (block.getType() != Material.AIR || !UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
{
UtilPlayer.message(Player, F.main("Game", "You cannot become a Solid Block here."));
Player.setExp(0f);
return;
}
//Set Block
_block = block;
//Effect
Player.playEffect(Player.getLocation(), Effect.STEP_SOUND, _mat);
//block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, _mat);
//Display
SolidifyVisual();
//Invisible
//Host.Manager.GetCondition().Factory().Cloak("Disguised as Block", Player, Player, 60000, false, false);
//Sound
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
}
}
}
//Is a Block
else
{
//Moved
if (!_loc.getBlock().equals(Player.getLocation().getBlock()))
{
SolidifyRemove();
}
//Send Packets
else
{
SolidifyVisual();
}
}
}
public void SolidifyRemove()
{
if (_block != null)
{
MapUtil.QuickChangeBlockAt(_block.getLocation(), 0, (byte)0);
_block = null;
}
Player.setExp(0f);
//Host.Manager.GetCondition().EndCondition(Player, null, "Disguised as Block");
//Inform
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 0.5f);
FallingBlockCheck();
}
@SuppressWarnings("deprecation")
public void SolidifyVisual()
{
if (_block == null)
return;
//Remove Old
if (Player.getPassenger() != null)
{
Recharge.Instance.useForce(Player, "PassengerChange", 100);
Player.getPassenger().remove();
Player.eject();
}
//Others
for (Player other : UtilServer.getPlayers())
other.sendBlockChange(Player.getLocation(), _mat, (byte)0);
//Self
Player.sendBlockChange(Player.getLocation(), 36, (byte)0);
FallingBlockCheck();
}
public void FallingBlockCheck()
{
//Block Form (Hide Falling)
if (_block != null)
return;
//Recreate Falling
if (Player.getPassenger() == null || !Player.getPassenger().isValid())
{
if (!Recharge.Instance.use(Player, "PassengerChange", 100, false, false))
return;
//Falling Block
FallingBlock block = Player.getWorld().spawnFallingBlock(Player.getEyeLocation(), _mat, (byte)0);
//No Arrow Collision
((CraftFallingSand)block).getHandle().spectating = true;
Player.setPassenger(block);
}
//Ensure Falling doesnt Despawn
else
{
((CraftFallingSand)Player.getPassenger()).getHandle().ticksLived = 1;
Player.getPassenger().setTicksLived(1);
}
}
public Block GetBlock()
{
return _block;
}
}

View File

@ -0,0 +1,94 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.EntityEffect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
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.UtilParticle.ParticleType;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.UpdateType;
public class ItemFleshHook extends ItemGadget implements IThrown
{
public ItemFleshHook(GadgetManager manager)
{
super(manager, "Flesh Hook", new String[]
{
C.cWhite + "Make new friends by throwing a hook",
C.cWhite + "into their face and pulling them",
C.cWhite + "towards you!",
},
-1,
Material.getMaterial(131), (byte)0,
2000, new Ammo("Flesh Hook", "50 Flesh Hooks", Material.getMaterial(131), (byte)0, new String[] { C.cWhite + "50 Flesh Hooks for you to use!" }, 1000, 50));
}
@Override
public void ActivateCustom(Player player)
{
//Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(131));
UtilAction.velocity(item, player.getLocation().getDirection(),
1.6, false, 0, 0.2, 10, false);
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true,
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 2d);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
//Effect
item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
data.GetThrown().remove();
if (!(data.GetThrower() instanceof Player))
return;
Player player = (Player)data.GetThrower();
if (target == null)
return;
//Pull
UtilAction.velocity(target,
UtilAlg.getTrajectory(target.getLocation(), player.getLocation()),
3, false, 0, 0.8, 1.5, true);
//Effect
target.playEffect(EntityEffect.HURT);
//Inform
UtilPlayer.message(target, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + "."));
}
@Override
public void Idle(ProjectileUser data)
{
data.GetThrown().remove();
}
@Override
public void Expire(ProjectileUser data)
{
data.GetThrown().remove();
}
}

View File

@ -0,0 +1,149 @@
package mineplex.core.gadget.gadgets;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Effect;
import org.bukkit.EntityEffect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
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.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ItemMelonLauncher extends ItemGadget implements IThrown
{
private HashSet<Item> _melon = new HashSet<Item>();
public ItemMelonLauncher(GadgetManager manager)
{
super(manager, "Melon Launcher", new String[]
{
C.cWhite + "Deliciously fun!",
C.cWhite + "Eat the melon slices for a",
C.cWhite + "temporary speed boost!",
},
-1,
Material.MELON_BLOCK, (byte)0,
1000, new Ammo("Melon Launcher", "100 Melons", Material.MELON_BLOCK, (byte)0, new String[] { C.cWhite + "100 Melons for you to launch!" }, 500, 100));
}
@Override
public void ActivateCustom(Player player)
{
//Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.MELON_BLOCK));
UtilAction.velocity(item, player.getLocation().getDirection(),
1, false, 0, 0.2, 10, false);
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true,
null, 1f, 1f, null, null, 0, UpdateType.TICK, 2d);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
//Effect
item.getWorld().playSound(item.getLocation(), Sound.EXPLODE, 0.5f, 0.5f);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target != null)
{
//Push
UtilAction.velocity(target,
UtilAlg.getTrajectory2d(data.GetThrown().getLocation(), target.getLocation()),
1.4, false, 0, 0.8, 1.5, true);
//Effect
target.playEffect(EntityEffect.HURT);
}
smash(data.GetThrown());
}
@Override
public void Idle(ProjectileUser data)
{
smash(data.GetThrown());
}
@Override
public void Expire(ProjectileUser data)
{
smash(data.GetThrown());
}
public void smash(Entity ent)
{
//Effect
ent.getWorld().playEffect(ent.getLocation(), Effect.STEP_SOUND, Material.MELON_BLOCK);
for (int i=0 ; i<10 ; i++)
{
Item item = ent.getWorld().dropItem(ent.getLocation(), ItemStackFactory.Instance.CreateStack(Material.MELON));
item.setVelocity(new Vector(UtilMath.rr(0.5, true), UtilMath.rr(0.5, false), UtilMath.rr(0.5, true)));
item.setPickupDelay(30);
_melon.add(item);
}
//Remove
ent.remove();
}
@EventHandler
public void pickupMelon(PlayerPickupItemEvent event)
{
if (!_melon.remove(event.getItem()))
return;
event.getItem().remove();
event.setCancelled(true);
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EAT, 1f, 1f);
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 80, 1), true);
}
@EventHandler
public void cleanupMelon(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
for (Iterator<Item> melonIterator = _melon.iterator(); melonIterator.hasNext();)
{
Item melon = melonIterator.next();
if (melon.isDead() || !melon.isValid() || melon.getTicksLived() > 400)
{
melonIterator.remove();
melon.remove();
}
}
}
}

View File

@ -0,0 +1,205 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.EntityEffect;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
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.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseBat;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.itemstack.ItemStackFactory;
public class MorphBat extends MorphGadget implements IThrown
{
public MorphBat(GadgetManager manager)
{
super(manager, "Bat Morph", new String[]
{
C.cWhite + "Flap around and annoy people by",
C.cWhite + "screeching loudly into their ears!",
" ",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Screech",
C.cYellow + "Double Jump" + C.cGray + " to use " + C.cGreen + "Flap",
C.cYellow + "Tap Sneak" + C.cGray + " to use " + C.cGreen + "Poop",
},
40000,
ArmorSlot.Helmet, Material.SKULL_ITEM, (byte)1);
}
@Override
public void EnableCustom(final Player player)
{
this.ApplyArmor(player);
DisguiseBat disguise = new DisguiseBat(player);
disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.SetCustomNameVisible(true);
Manager.getDisguiseManager().disguise(disguise);
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player);
player.setAllowFlight(false);
player.setFlying(false);
}
@EventHandler
public void Screech(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!IsActive(player))
return;
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 100, false, false))
return;
//Effect
player.getWorld().playSound(player.getLocation(), Sound.BAT_HURT, 1f, 1f);
}
@EventHandler
public void Poop(PlayerToggleSneakEvent event)
{
Player player = event.getPlayer();
if (player.isSneaking())
return;
if (player.getGameMode() == GameMode.CREATIVE)
return;
if (!IsActive(player))
return;
if (!Recharge.Instance.use(player, "Poop", 4000, true, false))
return;
//Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.MELON_SEEDS));
UtilAction.velocity(item, player.getLocation().getDirection(),
0.01, true, -0.3, 0, 10, false);
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true,
null, 1f, 1f, null, null, 0, UpdateType.TICK, 3d);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill("Poop") + "."));
player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 0.1f);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target != null)
{
//Effect
target.playEffect(EntityEffect.HURT);
target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 80, 1), true);
//Inform
UtilPlayer.message(target, F.main("Skill", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.skill("Bat Poop") + "."));
UtilPlayer.message(data.GetThrower(), F.main("Skill", "You hit " + F.name(UtilEnt.getName(target)) + " with " + F.skill("Bat Poop") + "."));
}
data.GetThrown().remove();
}
@Override
public void Idle(ProjectileUser data)
{
data.GetThrown().remove();
}
@Override
public void Expire(ProjectileUser data)
{
data.GetThrown().remove();
}
@EventHandler
public void Flap(PlayerToggleFlightEvent event)
{
Player player = event.getPlayer();
if (player.getGameMode() == GameMode.CREATIVE)
return;
if (!IsActive(player))
return;
event.setCancelled(true);
player.setFlying(false);
//Disable Flight
player.setAllowFlight(false);
//Velocity
UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, false, 0, 0.5, 0.8, true);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float)(0.3 + player.getExp()), (float)(Math.random()/2+0.5));
//Set Recharge
Recharge.Instance.use(player, GetName(), 40, false, false);
}
@EventHandler
public void FlapUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : GetActive())
{
if (player.getGameMode() == GameMode.CREATIVE)
continue;
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
{
player.setAllowFlight(true);
}
else if (Recharge.Instance.usable(player, GetName()))
{
player.setAllowFlight(true);
}
}
}
}

View File

@ -0,0 +1,98 @@
package mineplex.core.gadget.gadgets;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseBlock;
import mineplex.core.event.StackerEvent;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MorphBlock extends MorphGadget
{
private HashMap<Player, BlockForm> _active = new HashMap<Player, BlockForm>();
public MorphBlock(GadgetManager manager)
{
super(manager, "Block Morph", new String[]
{
C.cWhite + "The blockiest block that ever blocked.",
" ",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Change Block",
C.cYellow + "Stay Still" + C.cGray + " to use " + C.cGreen + "Solidify",
},
40000,
ArmorSlot.Helmet, Material.LEAVES, (byte)0);
}
@Override
public void EnableCustom(final Player player)
{
this.ApplyArmor(player);
_active.put(player, new BlockForm(this, player, Material.DIRT));
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
BlockForm form = _active.remove(player);
if (form != null)
{
form.Remove();
}
}
@EventHandler
public void formUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (BlockForm form : _active.values())
{
form.SolidifyUpdate();
form.FallingBlockCheck();
}
}
@EventHandler
public void stacker(PlayerInteractEvent event)
{
if (event.getClickedBlock() == null)
return;
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
BlockForm form = _active.get(event.getPlayer());
if (form == null)
return;
form.Remove();
_active.put(event.getPlayer(), new BlockForm(this, event.getPlayer(), event.getClickedBlock().getType()));
}
@EventHandler
public void stacker(StackerEvent event)
{
if (_active.containsKey(event.getEntity()))
event.setCancelled(true);
}
}

View File

@ -151,7 +151,6 @@ public class MorphChicken extends MorphGadget
{
if (event.getDamager() instanceof Egg)
{
event.getEntity().playEffect(EntityEffect.HURT);
event.getEntity().setVelocity(new Vector(0,0,0));
}
}

View File

@ -13,8 +13,6 @@ public class DragonMount extends Mount<DragonData>
super (manager, name, displayMaterial, displayData, desc, cost);
KnownPackage = false;
Manager.GetPlugin().getServer().getPluginManager().registerEvents(this, Manager.GetPlugin());
}
@Override

View File

@ -24,11 +24,11 @@ import org.bukkit.inventory.ItemStack;
public class HorseMount extends Mount<Horse>
{
private Color _color;
private Style _style;
private Variant _variant;
private double _jump;
private Material _armor;
protected Color _color;
protected Style _style;
protected Variant _variant;
protected double _jump;
protected Material _armor;
public HorseMount(MountManager manager, String name, String[] desc, Material displayMaterial, byte displayData, int cost, Color color, Style style, Variant variant, double jump, Material armor)
{
@ -40,8 +40,6 @@ public class HorseMount extends Mount<Horse>
_variant = variant;
_jump = jump;
_armor = armor;
Manager.GetPlugin().getServer().getPluginManager().registerEvents(this, Manager.GetPlugin());
}
@EventHandler

View File

@ -30,6 +30,8 @@ public abstract class Mount<T> extends SalesPackageBase implements Listener
super(name, material, displayData, description, coins);
Manager = manager;
Manager.GetPlugin().getServer().getPluginManager().registerEvents(this, Manager.GetPlugin());
}
@Override

View File

@ -19,6 +19,7 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.mount.types.*;
@ -27,17 +28,19 @@ public class MountManager extends MiniPlugin
private CoreClientManager _clientManager;
private DonationManager _donationManager;
private BlockRestore _blockRestore;
private DisguiseManager _disguiseManager;
private List<Mount<?>> _types;
private NautHashMap<Player, Mount<?>> _playerActiveMountMap = new NautHashMap<Player, Mount<?>>();
public MountManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, BlockRestore blockRestore)
public MountManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, BlockRestore blockRestore, DisguiseManager disguiseManager)
{
super("Mount Manager", plugin);
_clientManager = clientManager;
_donationManager = donationManager;
_blockRestore = blockRestore;
_disguiseManager = disguiseManager;
CreateGadgets();
}
@ -46,10 +49,13 @@ public class MountManager extends MiniPlugin
{
_types = new ArrayList<Mount<?>>();
_types.add(new Undead(this));
_types.add(new Frost(this));
_types.add(new Mule(this));
_types.add(new Dragon(this));
_types.add(new MountUndead(this));
_types.add(new MountFrost(this));
_types.add(new MountMule(this));
_types.add(new MountDragon(this));
_types.add(new MountSlime(this));
_types.add(new MountCart(this));
_types.add(new MountSheep(this));
}
public List<Mount<?>> getMounts()
@ -136,4 +142,9 @@ public class MountManager extends MiniPlugin
{
return _blockRestore;
}
public DisguiseManager getDisguiseManager()
{
return _disguiseManager;
}
}

View File

@ -0,0 +1,173 @@
package mineplex.core.mount.types;
import org.bukkit.ChatColor;
import org.bukkit.EntityEffect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.mount.Mount;
import mineplex.core.mount.MountManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MountCart extends Mount<Minecart>
{
public MountCart(MountManager manager)
{
super(manager, "Minecart", Material.MINECART, (byte)0, new String[]
{
ChatColor.RESET + "Cruise around town in your",
ChatColor.RESET + "new Minecart VX Turbo!",
},
15000);
KnownPackage = false;
}
public void EnableCustom(Player player)
{
player.leaveVehicle();
player.eject();
//Remove other mounts
Manager.DeregisterAll(player);
Minecart mount = player.getWorld().spawn(player.getLocation().add(0, 2, 0), Minecart.class);
//Inform
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
//Store
_active.put(player, mount);
}
public void Disable(Player player)
{
Minecart mount = _active.remove(player);
if (mount != null)
{
mount.remove();
//Inform
UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + "."));
Manager.removeActive(player);
}
}
@EventHandler
public void interactMount(PlayerInteractEntityEvent event)
{
if (event.getRightClicked() == null)
return;
if (!GetActive().containsKey(event.getPlayer()))
return;
if (!GetActive().get(event.getPlayer()).equals(event.getRightClicked()))
{
UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!"));
return;
}
event.getPlayer().leaveVehicle();
event.getPlayer().eject();
event.getRightClicked().setPassenger(event.getPlayer());
}
@EventHandler
public void target(EntityTargetEvent event)
{
if (!GetActive().containsKey(event.getTarget()))
return;
if (!GetActive().get(event.getTarget()).equals(event.getEntity()))
event.setCancelled(true);
}
@EventHandler
public void updateBounce(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
//Bounce
for (Minecart cart : GetActive().values())
{
if (cart.getPassenger() == null)
continue;
if (!UtilEnt.isGrounded(cart))
continue;
if (!(cart.getPassenger() instanceof Player))
continue;
UtilAction.velocity(cart, cart.getPassenger().getLocation().getDirection(), 1.4, true, 0, 0, 1, false);
if (Math.random() > 0.8)
cart.getWorld().playSound(cart.getLocation(), Sound.MINECART_BASE, 0.05f, 2f);
}
//Collide
for (Minecart cart : GetActive().values())
{
if (cart.getPassenger() == null)
continue;
if (!(cart.getPassenger() instanceof Player))
continue;
Player player = (Player)cart.getPassenger();
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
continue;
for (Minecart other : GetActive().values())
{
if (other.equals(cart))
continue;
if (other.getPassenger() == null)
continue;
if (!(other.getPassenger() instanceof Player))
continue;
Player otherPlayer = (Player)other.getPassenger();
if (!Recharge.Instance.usable(otherPlayer, GetName() + " Collide"))
continue;
//Collide
if (UtilMath.offset(cart, other) > 2)
continue;
Recharge.Instance.useForce(player, GetName() + " Collide", 500);
Recharge.Instance.useForce(otherPlayer, GetName() + " Collide", 500);
UtilAction.velocity(cart, UtilAlg.getTrajectory(other, cart), 1.2, false, 0, 0.8, 10, true);
UtilAction.velocity(other, UtilAlg.getTrajectory(cart, other), 1.2, false, 0, 0.8, 10, true);
cart.getWorld().playSound(cart.getLocation(), Sound.IRONGOLEM_HIT, 1f, 0.5f);
other.getWorld().playSound(other.getLocation(), Sound.IRONGOLEM_HIT, 1f, 0.5f);
//player.playEffect(EntityEffect.HURT);
//otherPlayer.playEffect(EntityEffect.HURT);
}
}
}
}

View File

@ -19,9 +19,9 @@ import mineplex.core.mount.MountManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class Dragon extends DragonMount
public class MountDragon extends DragonMount
{
public Dragon(MountManager manager)
public MountDragon(MountManager manager)
{
super(manager, "Ethereal Dragon", new String[]
{

View File

@ -21,9 +21,9 @@ import mineplex.core.mount.MountManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class Frost extends HorseMount
public class MountFrost extends HorseMount
{
public Frost(MountManager manager)
public MountFrost(MountManager manager)
{
super(manager, "Glacial Steed", new String[]
{

View File

@ -9,9 +9,9 @@ import org.bukkit.entity.Horse.Variant;
import mineplex.core.mount.HorseMount;
import mineplex.core.mount.MountManager;
public class Mule extends HorseMount
public class MountMule extends HorseMount
{
public Mule(MountManager manager)
public MountMule(MountManager manager)
{
super(manager, "Mount Mule", new String[]
{

View File

@ -0,0 +1,66 @@
package mineplex.core.mount.types;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Player;
import org.bukkit.entity.Horse.Style;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.disguise.disguises.DisguiseSheep;
import mineplex.core.mount.HorseMount;
import mineplex.core.mount.MountManager;
public class MountSheep extends HorseMount
{
public MountSheep(MountManager manager)
{
super(manager, "Techno Sheep", new String[]
{
ChatColor.RESET + "Muley muley!"
},
Material.WOOL,
(byte)14,
3000,
Color.BLACK, Style.BLACK_DOTS, Variant.MULE, 1.0, null);
}
@Override
public void EnableCustom(Player player)
{
player.leaveVehicle();
player.eject();
//Remove other mounts
Manager.DeregisterAll(player);
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
horse.setAdult();
horse.setAgeLock(true);
horse.setColor(_color);
horse.setStyle(_style);
horse.setVariant(_variant);
horse.setOwner(player);
horse.setMaxDomestication(1);
horse.setJumpStrength(_jump);
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
DisguiseSheep disguise = new DisguiseSheep(horse);
disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.SetCustomNameVisible(true);
//disguise.setColor(DyeColor.getByColor(org.bukkit.Color.fromRGB(100, 0, 200)));
Manager.getDisguiseManager().disguise(disguise);
//Inform
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
//Store
_active.put(player, horse);
}
}

View File

@ -0,0 +1,184 @@
package mineplex.core.mount.types;
import org.bukkit.ChatColor;
import org.bukkit.EntityEffect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.mount.Mount;
import mineplex.core.mount.MountManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MountSlime extends Mount<Slime>
{
public MountSlime(MountManager manager)
{
super(manager, "Slime Mount", Material.SLIME_BALL, (byte)0, new String[]
{
ChatColor.RESET + "Bounce around on your very",
ChatColor.RESET + "own personal slime friend!",
},
15000);
KnownPackage = false;
}
public void EnableCustom(Player player)
{
player.leaveVehicle();
player.eject();
//Remove other mounts
Manager.DeregisterAll(player);
Slime mount = player.getWorld().spawn(player.getLocation(), Slime.class);
mount.setSize(2);
mount.setCustomName(player.getName() + "'s " + GetName());
mount.setCustomNameVisible(true);
//Inform
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
//Store
_active.put(player, mount);
}
public void Disable(Player player)
{
Slime mount = _active.remove(player);
if (mount != null)
{
mount.remove();
//Inform
UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + "."));
Manager.removeActive(player);
}
}
@EventHandler
public void interactMount(PlayerInteractEntityEvent event)
{
if (event.getRightClicked() == null)
return;
if (!GetActive().containsKey(event.getPlayer()))
return;
if (!GetActive().get(event.getPlayer()).equals(event.getRightClicked()))
{
UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!"));
return;
}
event.getPlayer().leaveVehicle();
event.getPlayer().eject();
event.getRightClicked().setPassenger(event.getPlayer());
}
@EventHandler
public void target(EntityTargetEvent event)
{
if (!GetActive().containsKey(event.getTarget()))
return;
if (!GetActive().get(event.getTarget()).equals(event.getEntity()))
event.setCancelled(true);
}
@EventHandler
public void updateBounce(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
//Bounce
for (Slime slime : GetActive().values())
{
if (slime.getPassenger() == null)
continue;
if (!UtilEnt.isGrounded(slime))
continue;
if (!(slime.getPassenger() instanceof Player))
continue;
Player player = (Player)slime.getPassenger();
if (!Recharge.Instance.use(player, GetName(), 200, false, false))
continue;
UtilAction.velocity(slime, slime.getPassenger().getLocation().getDirection(), 1, true, 0, 0.4, 1, true);
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.75f);
}
//Collide
for (Slime slime : GetActive().values())
{
if (slime.getPassenger() == null)
continue;
if (!(slime.getPassenger() instanceof Player))
continue;
Player player = (Player)slime.getPassenger();
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
continue;
for (Slime other : GetActive().values())
{
if (other.equals(slime))
continue;
if (other.getPassenger() == null)
continue;
if (!(other.getPassenger() instanceof Player))
continue;
Player otherPlayer = (Player)other.getPassenger();
if (!Recharge.Instance.usable(otherPlayer, GetName() + " Collide"))
continue;
//Collide
if (UtilMath.offset(slime, other) > 2)
continue;
Recharge.Instance.useForce(player, GetName() + " Collide", 500);
Recharge.Instance.useForce(otherPlayer, GetName() + " Collide", 500);
UtilAction.velocity(slime, UtilAlg.getTrajectory(other, slime), 1.2, false, 0, 0.8, 10, true);
UtilAction.velocity(other, UtilAlg.getTrajectory(slime, other), 1.2, false, 0, 0.8, 10, true);
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_ATTACK, 1f, 0.5f);
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.5f);
other.getWorld().playSound(other.getLocation(), Sound.SLIME_WALK, 1f, 0.5f);
slime.playEffect(EntityEffect.HURT);
other.playEffect(EntityEffect.HURT);
}
}
}
}

View File

@ -17,9 +17,9 @@ import mineplex.core.mount.MountManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class Undead extends HorseMount
public class MountUndead extends HorseMount
{
public Undead(MountManager manager)
public MountUndead(MountManager manager)
{
super(manager, "Infernal Horror", new String[]
{

View File

@ -9,6 +9,7 @@ import mineplex.core.antistack.AntiStack;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
@ -48,7 +49,6 @@ import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
import mineplex.minecraft.game.core.IRelation;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire;

View File

@ -52,6 +52,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguisePlayer;
@ -66,6 +67,7 @@ import mineplex.core.mount.MountManager;
import mineplex.core.pet.PetManager;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
import mineplex.core.stats.StatsManager;
import mineplex.core.task.TaskManager;
import mineplex.core.updater.UpdateType;
@ -86,7 +88,6 @@ import mineplex.hub.poll.PollManager;
import mineplex.hub.tutorial.TutorialManager;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class HubManager extends MiniClientPlugin<HubClient>
@ -152,9 +153,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
_news = new NewsManager(this);
_mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore);
_mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager);
_inventoryManager = new InventoryManager(plugin);
_gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore);
_gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin));
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager);
_partyManager = partyManager;

View File

@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseBat;
import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.disguise.disguises.DisguiseCreeper;
import mineplex.core.updater.UpdateType;
@ -43,7 +44,7 @@ public class JumpManager extends MiniPlugin
//Chicken Cancel
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise != null && disguise instanceof DisguiseChicken)
if (disguise != null && (disguise instanceof DisguiseChicken || disguise instanceof DisguiseBat))
return;
event.setCancelled(true);

View File

@ -18,7 +18,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.mount.Mount;
import mineplex.core.mount.types.Dragon;
import mineplex.core.mount.types.MountDragon;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager;
@ -253,10 +253,10 @@ public class NewsManager extends MiniPlugin
for (Mount mount : Manager.GetMount().getMounts())
{
if (mount instanceof Dragon)
if (mount instanceof MountDragon)
{
((Dragon)mount).SetName(text);
((Dragon)mount).setHealthPercent(healthPercent);
((MountDragon)mount).SetName(text);
((MountDragon)mount).setHealthPercent(healthPercent);
}
}
}

View File

@ -33,7 +33,9 @@ import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.event.StackerEvent;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileManager;
import mineplex.core.projectile.ProjectileUser;
@ -71,6 +73,11 @@ public class StackerManager extends MiniPlugin implements IThrown
if (UtilGear.isMat(stacker.getItemInHand(), Material.SNOW_BALL))
return;
StackerEvent stackerEvent = new StackerEvent(stacker);
Bukkit.getServer().getPluginManager().callEvent(stackerEvent);
if (stackerEvent.isCancelled())
return;
//Parkour Disable
if (Manager.GetParkour().InsideParkour(stacker.getLocation()))
{
@ -106,6 +113,11 @@ public class StackerManager extends MiniPlugin implements IThrown
if (stackee instanceof Player && ((Player)stackee).getGameMode() != GameMode.SURVIVAL)
return;
stackerEvent = new StackerEvent(stackee);
Bukkit.getServer().getPluginManager().callEvent(stackerEvent);
if (stackerEvent.isCancelled())
return;
if (stackee instanceof Player && !Manager.CanBump(((Player)stackee)))
{
UtilPlayer.message(stacker, F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " is not playing stacker."));
@ -162,6 +174,11 @@ public class StackerManager extends MiniPlugin implements IThrown
if (throwee == null)
return;
StackerEvent stackerEvent = new StackerEvent(thrower);
Bukkit.getServer().getPluginManager().callEvent(stackerEvent);
if (stackerEvent.isCancelled())
return;
thrower.eject();
Entity throweeStack = throwee.getPassenger();

View File

@ -3,9 +3,9 @@ package mineplex.minecraft.game.classcombat.Condition;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.core.condition.ConditionEffect;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
public class SkillConditionEffect extends ConditionEffect
{

View File

@ -1,8 +1,6 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
import mineplex.core.recharge.Recharge;
@ -12,6 +10,8 @@ import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;

View File

@ -12,7 +12,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffectType;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent;
@ -24,6 +23,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;

View File

@ -3,11 +3,11 @@ package mineplex.minecraft.game.classcombat.Skill.Global;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
public class Resistance extends Skill
{

View File

@ -13,13 +13,13 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.potion.PotionEffectType;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;

View File

@ -11,13 +11,13 @@ import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;

View File

@ -22,10 +22,10 @@ import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
public class ArcticArmor extends Skill
{

View File

@ -7,8 +7,8 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilGear;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;

View File

@ -12,11 +12,8 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffectType;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.updater.event.UpdateEvent;

View File

@ -6,10 +6,10 @@ import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilMath;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.classcombat.Skill.SkillCharge;
import mineplex.minecraft.game.classcombat.Skill.SkillChargeSword;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.entity.Arrow;

View File

@ -14,7 +14,6 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear;
@ -25,6 +24,7 @@ import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;

View File

@ -8,6 +8,7 @@ import java.util.List;
import mineplex.core.MiniPlugin;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.core.donation.repository.GameSalesPackageToken;
import mineplex.core.energy.Energy;
import mineplex.core.movement.Movement;
@ -27,7 +28,6 @@ import mineplex.minecraft.game.classcombat.Skill.repository.SkillRepository;
import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken;
import mineplex.minecraft.game.core.IRelation;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire;

View File

@ -10,10 +10,10 @@ import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.projectile.ProjectileUser;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.classcombat.item.ItemUsable;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
public class Soup extends ItemUsable
{

View File

@ -7,6 +7,7 @@ import java.util.HashSet;
import mineplex.core.MiniPlugin;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.core.energy.Energy;
import mineplex.minecraft.game.core.fire.Fire;
import mineplex.core.projectile.ProjectileManager;
@ -14,7 +15,6 @@ import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.item.Consume.*;
import mineplex.minecraft.game.classcombat.item.Throwable.*;
import mineplex.minecraft.game.classcombat.item.weapon.*;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.DamageManager;
import org.bukkit.Material;

View File

@ -9,8 +9,8 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.DamageManager;
import org.bukkit.Effect;

View File

@ -33,6 +33,7 @@ import mineplex.core.packethandler.PacketHandler;
import mineplex.core.pet.PetManager;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
import mineplex.core.punish.Punish;
import mineplex.core.recharge.Recharge;
import mineplex.core.spawn.Spawn;
@ -109,16 +110,18 @@ public class Arcade extends JavaPlugin
BlockRestore blockRestore = new BlockRestore(this);
ProjectileManager projectileManager = new ProjectileManager(this);
//Inventory
InventoryManager inventoryManager = new InventoryManager(this);
PetManager petManager = new PetManager(this, _clientManager, _donationManager, creature, webServerAddress);
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore);
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore);
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager);
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager);
cosmeticManager.setInterfaceSlot(7);
//Arcade Manager
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, preferenceManager, inventoryManager, cosmeticManager, webServerAddress);
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, preferenceManager, inventoryManager, cosmeticManager, projectileManager, webServerAddress);
new MemoryFix(this);

View File

@ -47,8 +47,6 @@ import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
import mineplex.minecraft.game.core.IRelation;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire;
import mineplex.core.MiniPlugin;
@ -63,6 +61,8 @@ import mineplex.core.blood.Blood;
import mineplex.core.chat.Chat;
import mineplex.core.common.Rank;
import mineplex.core.common.util.*;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager;
@ -134,7 +134,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager,
DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, AntiStack antistack,
Portal portal, PacketHandler packetHandler, PreferencesManager preferences, InventoryManager inventoryManager,
CosmeticManager cosmeticManager, String webAddress)
CosmeticManager cosmeticManager, ProjectileManager projectileManager, String webAddress)
{
super("Game Manager", plugin);
@ -182,7 +182,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_firework = new FireworkHandler();
_fire = new Fire(plugin, _conditionManager, damageManager);
_projectileManager = new ProjectileManager(plugin);
_projectileManager = projectileManager;
if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|| serverConfig.GameList.contains(GameType.ChampionsTDM)

View File

@ -1,8 +1,6 @@
package nautilus.game.arcade.addons;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.inventory.InventoryClickEvent;
@ -12,10 +10,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.PlayerKitGiveEvent;

View File

@ -41,8 +41,8 @@ import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;

View File

@ -35,11 +35,11 @@ import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;

View File

@ -13,11 +13,11 @@ import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;

View File

@ -10,12 +10,12 @@ import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.mount.Mount;
import mineplex.core.mount.types.Dragon;
import mineplex.core.mount.types.MountDragon;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.RestartServerEvent;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GamePrepareCountdownCommence;
@ -83,10 +83,10 @@ public class GameManager implements Listener
for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts())
{
if (mount instanceof Dragon)
if (mount instanceof MountDragon)
{
((Dragon) mount).SetName(text);
((Dragon) mount).setHealthPercent(health);
((MountDragon) mount).SetName(text);
((MountDragon) mount).setHealthPercent(health);
}
}
}

View File

@ -29,12 +29,12 @@ import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.minecraft.core.condition.ConditionManager;
import mineplex.core.creature.Creature;
import mineplex.core.energy.Energy;
import mineplex.core.explosion.Explosion;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.fire.Fire;
import mineplex.minecraft.game.core.mechanics.Weapon;
import nautilus.game.pvp.modules.Farming;

View File

@ -25,7 +25,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
import me.chiss.Core.Combat.Event.CombatDeathEvent;
import mineplex.minecraft.game.core.classcombat.SkillTriggerEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.blockrestore.BlockRestoreData;
import mineplex.core.common.util.C;
@ -35,6 +34,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.minecraft.core.condition.Condition.ConditionType;
import mineplex.core.itemstack.ItemStackFactory;
public class ClansGame