Allow flaming arrows to ignite TNT.
It turns out that, according to the Spigot API, flaming arrows actually _change_ TNT blocks to air before/instead of igniting them. While this is a little counter-intuitive, the fix seems to revolve around allowing the change to happen if the changed block is TNT and the "changer" is an arrow. Allowing the change event to happen means "foreign" primed TNT entities will spawn, which makes it necessary to clean them up during the session cleanup phase in ArenaImpl. Fixes #696
This commit is contained in:
@@ -1400,6 +1400,7 @@ public class ArenaImpl implements Arena
|
||||
case ARROW:
|
||||
case MINECART:
|
||||
case BOAT:
|
||||
case PRIMED_TNT:
|
||||
case SHULKER_BULLET:
|
||||
e.remove();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.AbstractHorse;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Horse;
|
||||
@@ -952,8 +953,32 @@ public class ArenaListener
|
||||
}
|
||||
|
||||
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||
if (arena.getRegion().contains(event.getBlock().getLocation()))
|
||||
event.setCancelled(true);
|
||||
if (!protect) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = event.getBlock();
|
||||
if (!arena.getRegion().contains(block.getLocation())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (arena.isRunning()) {
|
||||
if (block.getType() == Material.TNT) {
|
||||
Entity entity = event.getEntity();
|
||||
if (entity instanceof Arrow) {
|
||||
Arrow arrow = (Arrow) entity;
|
||||
ProjectileSource shooter = arrow.getShooter();
|
||||
if (shooter instanceof Player) {
|
||||
Player player = (Player) shooter;
|
||||
if (arena.inArena(player)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
|
||||
|
||||
Reference in New Issue
Block a user