Skip to content

Commit

Permalink
- Fix world explosion setting not allowing explosions to damage
Browse files Browse the repository at this point in the history
animals, armorstands, itemframes and endercrystals in the wilderness
when they ought be exploded.
    - Closes ticket #3459
  • Loading branch information
LlmDl committed Oct 19, 2019
1 parent d2316cb commit 36fd9d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 3 additions & 1 deletion resources/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3614,4 +3614,6 @@ v0.92.0.11:
- Closes ticket #3443
- The german.yml has been updated to 0.56 by Sprugente.
0.95.0.2:
- Fix missing placeholder %townyadvanced_towny_tag_formatted% not actually existing.
- Fix missing placeholder %townyadvanced_towny_tag_formatted% not actually existing.
- Fix world explosion setting not allowing explosions to damage animals, armorstands, itemframes and endercrystals in the wilderness when they ought be exploded.
- Closes ticket #3459
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,22 @@ public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
TownyMessaging.sendDebugMsg("EntityDamageByEntityEvent : entity = " + entity);
TownyMessaging.sendDebugMsg("EntityDamageByEntityEvent : damager = " + damager);

// Entities requiring special protection.
if (entity instanceof ArmorStand || entity instanceof ItemFrame || entity instanceof Animals || entity instanceof EnderCrystal) {
if (damager.equals("PRIMED_TNT") || damager.equals("MINECART_TNT") || damager.equals("WITHER_SKULL") || damager.equals("FIREBALL") ||
damager.equals("SMALL_FIREBALL") || damager.equals("LARGE_FIREBALL") || damager.equals("WITHER") || damager.equals("CREEPER") || damager.equals("FIREWORK")) {

// Handle exploding causes of damage.
if (damager.equals("PRIMED_TNT") || damager.equals("MINECART_TNT") || damager.equals("WITHER_SKULL") || damager.equals("FIREBALL") ||
damager.equals("SMALL_FIREBALL") || damager.equals("LARGE_FIREBALL") || damager.equals("WITHER") || damager.equals("CREEPER") || damager.equals("FIREWORK")) {

if (!locationCanExplode(townyWorld, entity.getLocation())) {
event.setCancelled(true);
return;
} else {
return;
}
}

// Handle arrows and projectiles that do not explode.
if (event.getDamager() instanceof Projectile) {

try {
Expand Down Expand Up @@ -347,6 +354,8 @@ public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
event.setCancelled(true);
}
}

// Handle player causes against entities that should be protected.
if (event.getDamager() instanceof Player) {
Player player = (Player) event.getDamager();
boolean bDestroy = false;
Expand Down

0 comments on commit 36fd9d0

Please sign in to comment.