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:
@@ -33,6 +33,7 @@ These changes will (most likely) be included in the next version.
|
||||
- The title-based announcer and the title-based boss health bar have been fixed to work with the breaking change to the Title API in Spigot 1.17.
|
||||
- Arena Signs now correctly update for arenas that don't have `kebab-case` names in the config-file.
|
||||
- Block explosion events cancelled by other plugins now remain cancelled unless MobArena specifically uncancels them for an arena.
|
||||
- Flaming arrows now ignite TNT blocks in the arena.
|
||||
|
||||
## [0.106] - 2021-05-09
|
||||
### Added
|
||||
|
||||
@@ -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,7 +953,31 @@ public class ArenaListener
|
||||
}
|
||||
|
||||
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||
if (arena.getRegion().contains(event.getBlock().getLocation()))
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user