SPIGOT-519: Add TNTPrimeEvent

Thanks to Pokechu22 for an earlier implementation

By: Jishuna <joshl5324@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2023-05-03 20:46:43 +10:00
parent d58f895450
commit ba817be945
5 changed files with 93 additions and 9 deletions

View File

@@ -114,7 +114,7 @@
}
}
}
@@ -234,12 +269,24 @@
@@ -234,12 +269,28 @@
return iblockdata.hasProperty(BlockProperties.WATERLOGGED) && (Boolean) iblockdata.getValue(BlockProperties.WATERLOGGED) ? 0 : this.igniteOdds.getInt(iblockdata.getBlock());
}
@@ -135,6 +135,10 @@
+ if (event.isCancelled()) {
+ return;
+ }
+
+ if (iblockdata.getBlock() instanceof BlockTNT && !CraftEventFactory.callTNTPrimeEvent(world, blockposition, org.bukkit.event.block.TNTPrimeEvent.PrimeCause.FIRE, null, sourceposition)) {
+ return;
+ }
+ // CraftBukkit end
+
if (randomsource.nextInt(j + 10) < 5 && !world.isRainingAt(blockposition)) {