diff --git a/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/ClickHandler.java b/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/ClickHandler.java index 0eaea8f..0fdcaa0 100644 --- a/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/ClickHandler.java +++ b/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/ClickHandler.java @@ -158,6 +158,8 @@ public class ClickHandler implements Listener { @EventHandler(priority = EventPriority.HIGH) public void BlockPlaceEvent(org.bukkit.event.block.BlockPlaceEvent event) { Player thePlayer = event.getPlayer(); + if (event.isCancelled()) + return; if (event.getPlayer().getInventory().getItemInMainHand().getType() == Material.CARVED_PUMPKIN) { ItemStack item = event.getPlayer().getInventory().getItemInMainHand(); if (item.getItemMeta() != null && item.getItemMeta().hasCustomModelData()) { @@ -179,7 +181,6 @@ public class ClickHandler implements Listener { public void Shoot(Entity player, long delay) { float actualDelay = delay; Boolean FirstShot = true; - if (GunnersCore.TrackedStands.get(player.getUniqueId()) == null) { for (Entity ent : player.getNearbyEntities(5, 5, 5)) { if(ent instanceof ArmorStand) { @@ -192,8 +193,8 @@ public class ClickHandler implements Listener { } if (GunnersCore.TrackedStands.get(player.getUniqueId()) == null) return; + int counter = 0; for (Entity ent : GunnersCore.TrackedStands.get(player.getUniqueId())){ - if (ent == null || ent.isDead()) { continue; } @@ -202,8 +203,10 @@ public class ClickHandler implements Listener { continue; } GunnerEquipment siege = GunnersCore.equipment.get(ent.getUniqueId()); - + if (counter > 4) + continue; if (siege.isLoaded()) { + counter++; if (player instanceof Player) { siege.Fire(player, actualDelay,0); actualDelay += delay; @@ -260,7 +263,7 @@ public class ClickHandler implements Listener { if (event.getAction() == Action.RIGHT_CLICK_AIR) { - if (ItemInHand.getType() != Material.BOOK) { + if (ItemInHand.getType() != Material.COMPASS) { return; } if (!player.isSneaking()) diff --git a/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/GunnerEquipment.java b/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/GunnerEquipment.java index de108cc..964b8b2 100644 --- a/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/GunnerEquipment.java +++ b/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/GunnerEquipment.java @@ -61,7 +61,7 @@ public class GunnerEquipment implements Cloneable { public Boolean RotateStandHead = true; public Boolean HasFired = false; public Boolean HasReloaded = false; - public Boolean AllowInvisibleStand = true; + public Boolean AllowInvisibleStand = false; public Boolean HaseBaseStand = false; public double BaseStandOffset = 0; public int BaseStandModelNumber = 147; diff --git a/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/GunnersCore.java b/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/GunnersCore.java index 5c8945d..1d64061 100644 --- a/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/GunnersCore.java +++ b/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/GunnersCore.java @@ -185,7 +185,6 @@ public class GunnersCore extends JavaPlugin { // TODO Auto-generated catch block } - return null; } @@ -333,7 +332,7 @@ public class GunnersCore extends JavaPlugin { // pig.SoundType = Sound.ITEM_CROSSBOW_SHOOT; // pig.ParticleType = Particle.GLOW; // equip.Projectiles.put(Material.PORKCHOP, pig); - // equip.Projectiles.put(Material.BONE, new PotionProjectile()); +// equip.Projectiles.put(Material.BONE, new PotionProjectile()); } @@ -346,6 +345,7 @@ public class GunnersCore extends JavaPlugin { return false; } l.setY(l.getY() + 1); + int maxNearby = 0; l.setDirection(player.getFacing().getDirection()); ItemStack item = new ItemStack(Material.CARVED_PUMPKIN); @@ -353,7 +353,6 @@ public class GunnersCore extends JavaPlugin { String id = ""; equip.AmmoHolder = new EquipmentMagazine(); if (equip.HaseBaseStand) { - Location l2 = l; l2.setY(l.getY() + equip.BaseStandOffset); @@ -396,6 +395,14 @@ public class GunnersCore extends JavaPlugin { LivingEntity ent = (LivingEntity) entity2; ArmorStand stand = (ArmorStand) ent; equip.Entity = entity2; + for (Entity le : l.getNearbyEntities(5, 5, 5)) { + if (maxNearby >= 4) { + ent.damage(100.0d,player); + return false; + } + if (le instanceof ArmorStand) + maxNearby++; + } equip.EntityId = entity2.getUniqueId(); stand.addEquipmentLock(EquipmentSlot.HEAD, LockType.REMOVING_OR_CHANGING); diff --git a/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/PotionProjectile.java b/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/PotionProjectile.java index 19d3040..8856241 100644 --- a/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/PotionProjectile.java +++ b/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/PotionProjectile.java @@ -32,7 +32,7 @@ public class PotionProjectile implements GunnersProjectile { @Override public void Shoot(Entity player, Entity entity, Location loc, Float velocity) { - // TODO Auto-generated method stub + //TODO Auto-generated method stub int baseDelay = 0; for (int i = 0; i < EntityCount; i++) { if (DelayedFire) { @@ -43,10 +43,8 @@ public class PotionProjectile implements GunnersProjectile { }, (long) baseDelay); } else { - CreateEntity(entity, loc, velocity); } - // } } } @@ -56,8 +54,7 @@ public class PotionProjectile implements GunnersProjectile { Entity arrow = world.spawnEntity(loc, EntityType.SPLASH_POTION); if (Inaccuracy != 0f) { - arrow.setVelocity(loc.getDirection().multiply(velocity).add(Randomise()) - .subtract(Randomise())); + arrow.setVelocity(loc.getDirection().multiply(velocity).add(Randomise()).subtract(Randomise())); } else { arrow.setVelocity(loc.getDirection().multiply(velocity)); diff --git a/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/RotationHandler.java b/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/RotationHandler.java index 2042bd1..a4868f4 100644 --- a/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/RotationHandler.java +++ b/CrunchSiegeEquipment/src/main/java/com/gunners/GunnersCore/RotationHandler.java @@ -31,7 +31,7 @@ public class RotationHandler implements Listener { if (GunnersCore.TrackedStands.containsKey(player.getUniqueId())) { ItemStack itemInHand = player.getInventory().getItemInMainHand(); if (itemInHand != null) { - if (itemInHand.getType() != Material.BOOK) { + if (itemInHand.getType() != Material.COMPASS) { // TrackedStands.remove(player.getUniqueId()); return; @@ -58,12 +58,9 @@ public class RotationHandler implements Listener { baseloc.setDirection(dirBetweenLocations); base.teleport(baseloc); } - - - - loc.setDirection(dirBetweenLocations); + loc.setDirection(dirBetweenLocations); } - // loc.setYaw(player.getLocation().getYaw()); + //loc.setYaw(player.getLocation().getYaw()); //loc.setPitch(player.getLocation().getPitch());