mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-03 22:21:12 +00:00
Ok! working copy
This commit is contained in:
1 parent
6fbf7397b4
commit
77f1e6e544
2 files changed
+9
-8
No files matched your search
@@ -73,6 +73,14 @@ public class ClickHandler implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onHit(ProjectileHitEvent event) {
|
public void onHit(ProjectileHitEvent event) {
|
||||||
|
for (Entity entity : event.getEntity().getNearbyEntities(2, 2, 2)) {
|
||||||
|
if (entity instanceof ArmorStand) {
|
||||||
|
ArmorStand stand = (ArmorStand) entity;
|
||||||
|
if (isSiegeEngine(stand,false)) {
|
||||||
|
PlayerHandler.siegeEngineEntityDied(stand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if ((event.getEntity() instanceof Projectile)
|
if ((event.getEntity() instanceof Projectile)
|
||||||
&& projectiles.containsKey(event.getEntity().getUniqueId())) {
|
&& projectiles.containsKey(event.getEntity().getUniqueId())) {
|
||||||
ExplosiveProjectile proj = projectiles.get(event.getEntity().getUniqueId());
|
ExplosiveProjectile proj = projectiles.get(event.getEntity().getUniqueId());
|
||||||
|
|||||||
@@ -38,14 +38,6 @@ public class PlayerHandler implements Listener {
|
|||||||
public static void siegeEngineEntityDied(Entity entity, boolean silent) {
|
public static void siegeEngineEntityDied(Entity entity, boolean silent) {
|
||||||
for (UUID uuid : SiegeEngines.siegeEngineEntitiesPerPlayer.keySet()) {
|
for (UUID uuid : SiegeEngines.siegeEngineEntitiesPerPlayer.keySet()) {
|
||||||
if (SiegeEngines.siegeEngineEntitiesPerPlayer.containsKey(uuid)) {
|
if (SiegeEngines.siegeEngineEntitiesPerPlayer.containsKey(uuid)) {
|
||||||
if (entity.isDead()) {
|
|
||||||
SiegeEngines.siegeEngineEntitiesPerPlayer.get(uuid).remove(entity);
|
|
||||||
SiegeEngines.activeSiegeEngines.remove(entity.getUniqueId());
|
|
||||||
}
|
|
||||||
if (!entity.isValid()) {
|
|
||||||
SiegeEngines.siegeEngineEntitiesPerPlayer.get(uuid).remove(entity);
|
|
||||||
SiegeEngines.activeSiegeEngines.remove(entity.getUniqueId());
|
|
||||||
}
|
|
||||||
for (UUID eUuid : SiegeEngines.activeSiegeEngines.keySet()) {
|
for (UUID eUuid : SiegeEngines.activeSiegeEngines.keySet()) {
|
||||||
if (Bukkit.getEntity(eUuid) == null || Bukkit.getEntity(eUuid).isDead() || !Bukkit.getEntity(eUuid).isValid()) {
|
if (Bukkit.getEntity(eUuid) == null || Bukkit.getEntity(eUuid).isDead() || !Bukkit.getEntity(eUuid).isValid()) {
|
||||||
SiegeEngines.activeSiegeEngines.remove(eUuid);
|
SiegeEngines.activeSiegeEngines.remove(eUuid);
|
||||||
@@ -53,6 +45,7 @@ public class PlayerHandler implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SiegeEngines.activeSiegeEngines.remove(entity.getUniqueId());
|
SiegeEngines.activeSiegeEngines.remove(entity.getUniqueId());
|
||||||
|
SiegeEngines.siegeEngineEntitiesPerPlayer.get(uuid).remove(entity);
|
||||||
SiegeEnginesLogger.debug("ENGINE DISABLED/DEAD "+entity.getUniqueId().toString());
|
SiegeEnginesLogger.debug("ENGINE DISABLED/DEAD "+entity.getUniqueId().toString());
|
||||||
}
|
}
|
||||||
if (!silent) Bukkit.getPlayer(uuid).sendMessage("§eSiege Engine Destroyed!");
|
if (!silent) Bukkit.getPlayer(uuid).sendMessage("§eSiege Engine Destroyed!");
|
||||||
|
|||||||
Reference in new issue
Block a user