Only process BlockPhysicsEvent if a plugin has a listener
Saves on some object allocation and processing when no plugin listens to this
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
+ // CraftBukkit start
|
||||
+ if (!state.canSurvive(world, pos)) {
|
||||
+ // Suppress during worldgen
|
||||
+ if (!(world instanceof Level world1) || !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world1, pos).isCancelled()) {
|
||||
+ if (!(world instanceof net.minecraft.server.level.ServerLevel world1 && world1.hasPhysicsEvent) || !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world1, pos).isCancelled()) { // Paper
|
||||
+ return Blocks.AIR.defaultBlockState();
|
||||
+ }
|
||||
+ }
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
protected static void preventDropFromBottomPart(Level world, BlockPos pos, BlockState state, Player player) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, pos).isCancelled()) {
|
||||
+ if (((net.minecraft.server.level.ServerLevel)world).hasPhysicsEvent && org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, pos).isCancelled()) { // Paper
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
Reference in New Issue
Block a user