mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-03 14:38:53 +00:00
Fix Destroy-Releasing again
Also attempt to fix the message spam upon Engine Destruction
This commit is contained in:
1 parent
64358e9b80
commit
5b22c1aed4
4 files changed
+14
-11
No files matched your search
@@ -595,16 +595,15 @@ public class ClickHandler implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
|
||||||
public void onEngineDamage(EntityDamageByEntityEvent event) {
|
public void onEngineDamage(EntityDamageByEntityEvent event) {
|
||||||
if (event.getEntity() instanceof ArmorStand) {
|
if (event.getEntity() instanceof ArmorStand) {
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
if (event.getDamager() instanceof Player) {
|
if (event.getDamager() instanceof Player) {
|
||||||
PlayerHandler.siegeEngineEntityDied(event.getEntity());
|
PlayerHandler.siegeEngineEntityDied(event.getEntity());
|
||||||
event.setDamage(20);
|
event.setDamage(2);
|
||||||
} else {
|
} else {
|
||||||
event.setDamage(5);
|
event.setDamage(4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -871,7 +870,7 @@ public class ClickHandler implements Listener {
|
|||||||
if (removeStands) {
|
if (removeStands) {
|
||||||
for (ItemStack i : items) {
|
for (ItemStack i : items) {
|
||||||
if (i.getType() == Material.ARMOR_STAND) {
|
if (i.getType() == Material.ARMOR_STAND) {
|
||||||
PlayerHandler.siegeEngineEntityDied(event.getEntity());
|
PlayerHandler.siegeEngineEntityDied(event.getEntity(),false);
|
||||||
SiegeEngines.activeSiegeEngines.remove(event.getEntity().getUniqueId());
|
SiegeEngines.activeSiegeEngines.remove(event.getEntity().getUniqueId());
|
||||||
i.setAmount(0);
|
i.setAmount(0);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ public class PlayerHandler implements Listener {
|
|||||||
playerJoinLeave(event.getPlayer());
|
playerJoinLeave(event.getPlayer());
|
||||||
}
|
}
|
||||||
public static void siegeEngineEntityDied(Entity entity) {
|
public static void siegeEngineEntityDied(Entity entity) {
|
||||||
|
siegeEngineEntityDied(entity,true);
|
||||||
|
}
|
||||||
|
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()) {
|
if (entity.isDead()) {
|
||||||
@@ -49,9 +52,10 @@ public class PlayerHandler implements Listener {
|
|||||||
if (SiegeEngines.siegeEngineEntitiesPerPlayer.get(uuid) != null) SiegeEngines.siegeEngineEntitiesPerPlayer.get(uuid).remove(Bukkit.getEntity(eUuid));
|
if (SiegeEngines.siegeEngineEntitiesPerPlayer.get(uuid) != null) SiegeEngines.siegeEngineEntitiesPerPlayer.get(uuid).remove(Bukkit.getEntity(eUuid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SiegeEngines.activeSiegeEngines.remove(entity.getUniqueId());
|
||||||
SiegeEnginesLogger.debug("ENGINE DISABLED/DEAD "+entity.getUniqueId().toString());
|
SiegeEnginesLogger.debug("ENGINE DISABLED/DEAD "+entity.getUniqueId().toString());
|
||||||
}
|
}
|
||||||
Bukkit.getPlayer(uuid).sendMessage("§eSiege Engine Destroyed!");
|
if (!silent) Bukkit.getPlayer(uuid).sendMessage("§eSiege Engine Destroyed!");
|
||||||
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);
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ public class RotationHandler implements Listener {
|
|||||||
if (equipment == null) continue;
|
if (equipment == null) continue;
|
||||||
final LivingEntity living = (LivingEntity) ent;
|
final LivingEntity living = (LivingEntity) ent;
|
||||||
if (Config.disabledWorlds.contains(ent.getWorld())) {
|
if (Config.disabledWorlds.contains(ent.getWorld())) {
|
||||||
PlayerHandler.siegeEngineEntityDied(ent);
|
|
||||||
living.setHealth(0.0d);
|
living.setHealth(0.0d);
|
||||||
|
PlayerHandler.siegeEngineEntityDied(ent);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!(ent.getLocation().getWorld().equals(player.getLocation().getWorld()))) {
|
if (!(ent.getLocation().getWorld().equals(player.getLocation().getWorld()))) {
|
||||||
|
|||||||
@@ -91,9 +91,9 @@ Projectiles:
|
|||||||
FireSound: ITEM_CROSSBOW_SHOOT
|
FireSound: ITEM_CROSSBOW_SHOOT
|
||||||
DragonsBreath:
|
DragonsBreath:
|
||||||
ProjectileType: ENTITY
|
ProjectileType: ENTITY
|
||||||
Inaccuracy: 0.125
|
Inaccuracy: 0.65
|
||||||
EntityCount: 1
|
EntityCount: 3
|
||||||
VelocityFactor: 1.0
|
VelocityFactor: 1.125
|
||||||
EntityType: DRAGON_FIREBALL
|
EntityType: DRAGON_FIREBALL
|
||||||
AmmoItem: DRAGON_BREATH
|
AmmoItem: DRAGON_BREATH
|
||||||
FireSound: ENTITY_GENERIC_EXPLODE
|
FireSound: ENTITY_GENERIC_EXPLODE
|
||||||
@@ -169,7 +169,7 @@ SiegeEngines:
|
|||||||
- StoneShot
|
- StoneShot
|
||||||
- RepeatingShot
|
- RepeatingShot
|
||||||
- BreachShot
|
- BreachShot
|
||||||
- FireShot
|
- DragonsBreath
|
||||||
- FireworkShot
|
- FireworkShot
|
||||||
ItemName: "&e&lBreach Cannon"
|
ItemName: "&e&lBreach Cannon"
|
||||||
Lore:
|
Lore:
|
||||||
|
|||||||
Reference in new issue
Block a user