diff --git a/bin/CrunchProjectiles/ExplosiveProjectile.class b/bin/CrunchProjectiles/ExplosiveProjectile.class index 0b8be6d..1495863 100644 Binary files a/bin/CrunchProjectiles/ExplosiveProjectile.class and b/bin/CrunchProjectiles/ExplosiveProjectile.class differ diff --git a/bin/siegeCore/ClickHandler.class b/bin/siegeCore/ClickHandler.class index 5677938..9e77ce6 100644 Binary files a/bin/siegeCore/ClickHandler.class and b/bin/siegeCore/ClickHandler.class differ diff --git a/bin/siegeCore/CrunchSiegeCore$SiegeCommand.class b/bin/siegeCore/CrunchSiegeCore$SiegeCommand.class index da509c3..f74d25b 100644 Binary files a/bin/siegeCore/CrunchSiegeCore$SiegeCommand.class and b/bin/siegeCore/CrunchSiegeCore$SiegeCommand.class differ diff --git a/bin/siegeCore/CrunchSiegeCore.class b/bin/siegeCore/CrunchSiegeCore.class index 0ff4515..a7c7838 100644 Binary files a/bin/siegeCore/CrunchSiegeCore.class and b/bin/siegeCore/CrunchSiegeCore.class differ diff --git a/bin/siegeCore/RotationHandler.class b/bin/siegeCore/RotationHandler.class index ada42f5..3048be3 100644 Binary files a/bin/siegeCore/RotationHandler.class and b/bin/siegeCore/RotationHandler.class differ diff --git a/src/CrunchProjectiles/ExplosiveProjectile.java b/src/CrunchProjectiles/ExplosiveProjectile.java index f754ad3..55ea2a2 100644 --- a/src/CrunchProjectiles/ExplosiveProjectile.java +++ b/src/CrunchProjectiles/ExplosiveProjectile.java @@ -59,6 +59,7 @@ public class ExplosiveProjectile implements CrunchProjectile { World world = entity.getLocation().getWorld(); Entity tnt = world.spawnEntity(loc, EntityType.SNOWBALL); Snowball ball = (Snowball) tnt; + ball.setShooter(player); ClickHandler.projectiles.put(tnt.getUniqueId(), this); diff --git a/src/siegeCore/ClickHandler.java b/src/siegeCore/ClickHandler.java index b2a6282..ba82244 100644 --- a/src/siegeCore/ClickHandler.java +++ b/src/siegeCore/ClickHandler.java @@ -377,12 +377,16 @@ public class ClickHandler implements Listener { ent.teleport(loc); } - + NamespacedKey key = new NamespacedKey(CrunchSiegeCore.plugin, "cannons"); @EventHandler public void DeathEvent(EntityDeathEvent event) { Boolean removeStands = false; List items = event.getDrops(); if (event.getEntity() instanceof ArmorStand) { + if (event.getEntity().getPersistentDataContainer().has(key, PersistentDataType.STRING)) { + Entity base = Bukkit.getEntity(UUID.fromString(event.getEntity().getPersistentDataContainer().get(key, PersistentDataType.STRING))); + base.remove(); + } if (CrunchSiegeCore.equipment.containsKey(event.getEntity().getUniqueId())) { removeStands = true; } @@ -553,7 +557,7 @@ public class ClickHandler implements Listener { if (entity.getType() == EntityType.ARMOR_STAND){ TakeControl(player, entity); if (CrunchSiegeCore.equipment.containsKey(entity.getUniqueId())) { - if (itemInHand.getType() == Material.COMPASS) { + if (itemInHand.getType() == Material.RECOVERY_COMPASS) { if (player.isSneaking()) { DoAimDown(entity, 1, player); } @@ -569,10 +573,12 @@ public class ClickHandler implements Listener { ArmorStand stand = (ArmorStand) entity; if (stand.isInvisible()) { stand.setInvisible(false); + player.sendMessage("Equipment is now breakable"); } else{ if (equipment.AllowInvisibleStand) { stand.setInvisible(true); + player.sendMessage("Equipment is no longer breakable"); } } } diff --git a/src/siegeCore/CrunchSiegeCore.java b/src/siegeCore/CrunchSiegeCore.java index 4f72b9a..2e1e1ee 100644 --- a/src/siegeCore/CrunchSiegeCore.java +++ b/src/siegeCore/CrunchSiegeCore.java @@ -15,6 +15,7 @@ import java.util.logging.Level; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.NamespacedKey; import org.bukkit.Particle; import org.bukkit.Sound; import org.bukkit.World; @@ -44,6 +45,7 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.persistence.PersistentDataType; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffect; @@ -299,7 +301,7 @@ public class CrunchSiegeCore extends JavaPlugin { public static Boolean CreateTrebuchet(Player player, int CustomModelData, Location l) { //l.setY(l.getY() - 1); l.add(0.5, 0, 0.5); - + NamespacedKey key = new NamespacedKey(CrunchSiegeCore.plugin, "cannons"); SiegeEquipment equip = CreateClone(CustomModelData); if (equip == null || !equip.Enabled) { return false; @@ -313,14 +315,18 @@ public class CrunchSiegeCore extends JavaPlugin { ItemStack item = new ItemStack(Material.CARVED_PUMPKIN); ItemMeta meta = item.getItemMeta(); - + String id = ""; equip.AmmoHolder = new EquipmentMagazine(); if (equip.HaseBaseStand) { + + Location l2 = l; l2.setY(l.getY() + equip.BaseStandOffset); Entity entity3 = player.getWorld().spawnEntity(l, EntityType.ARMOR_STAND); + LivingEntity ent = (LivingEntity) entity3; ArmorStand stand = (ArmorStand) ent; + id = entity3.getUniqueId().toString(); meta.setCustomModelData(equip.BaseStandModelNumber); stand.addEquipmentLock(EquipmentSlot.HEAD, LockType.REMOVING_OR_CHANGING); stand.addEquipmentLock(EquipmentSlot.LEGS, LockType.ADDING_OR_CHANGING); @@ -336,6 +342,9 @@ public class CrunchSiegeCore extends JavaPlugin { } l.setY(l.getY() + equip.PlacementOffsetY); Entity entity2 = player.getWorld().spawnEntity(l, EntityType.ARMOR_STAND); + if (id != "") { + entity2.getPersistentDataContainer().set(key, PersistentDataType.STRING, id); + } meta.setCustomModelData(equip.ReadyModelNumber); meta.setDisplayName("§e" + equip.EquipmentName +" spawn item"); List Lore = new ArrayList(); diff --git a/src/siegeCore/RotationHandler.java b/src/siegeCore/RotationHandler.java index c8ba06e..2ae56fa 100644 --- a/src/siegeCore/RotationHandler.java +++ b/src/siegeCore/RotationHandler.java @@ -1,9 +1,12 @@ package siegeCore; import java.awt.Color; +import java.util.UUID; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.NamespacedKey; import org.bukkit.Particle; import org.bukkit.block.Block; import org.bukkit.entity.ArmorStand; @@ -14,11 +17,13 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.persistence.PersistentDataType; import org.bukkit.util.BlockIterator; import org.bukkit.util.EulerAngle; import org.bukkit.util.Vector; public class RotationHandler implements Listener { + NamespacedKey key = new NamespacedKey(CrunchSiegeCore.plugin, "cannons"); @EventHandler public void playerMove(PlayerMoveEvent event) { Player player = event.getPlayer(); @@ -42,11 +47,17 @@ public class RotationHandler implements Listener { Location loc = ent.getLocation(); if (equipment.RotateSideways) { - - - Location direction = player.getLocation().add(player.getLocation().getDirection().multiply(50)); + Location direction = player.getLocation().add(player.getLocation().getDirection().multiply(50)); - Vector dirBetweenLocations = direction.toVector().subtract(loc.toVector()); + Vector dirBetweenLocations = direction.toVector().subtract(loc.toVector()); + if (ent.getPersistentDataContainer().has(key, PersistentDataType.STRING)) { + Entity base = Bukkit.getEntity(UUID.fromString(ent.getPersistentDataContainer().get(key, PersistentDataType.STRING))); + Location baseloc = base.getLocation(); + baseloc.setDirection(dirBetweenLocations); + base.teleport(baseloc); + } + + loc.setDirection(dirBetweenLocations); }