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:
Aikar
2016-03-28 19:55:45 -04:00
parent b2671f4dd1
commit 63fa3068c6
5 changed files with 54 additions and 51 deletions

View File

@ -415,7 +415,7 @@
+ // CraftBukkit start
+ iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam
+ CraftWorld world = ((ServerLevel) this).getWorld();
+ if (world != null) {
+ if (world != null && ((ServerLevel)this).hasPhysicsEvent) { // Paper - BlockPhysicsEvent
+ BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata));
+ this.getCraftServer().getPluginManager().callEvent(event);
+