Fix crops not popping when no plugin listens to physics

This commit is contained in:
Aikar 2019-03-03 12:22:24 -05:00
parent e5f0d0f5dc
commit f0d45d4eab
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE

View File

@ -1,4 +1,4 @@
From 941df3324d3654d4b28b0eae444131154ec25ba0 Mon Sep 17 00:00:00 2001
From 06f64c95ff6f0e07d8fffa60b551ecf7e32700a1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 19:55:45 -0400
Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener
@ -6,7 +6,7 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener
Saves on some object allocation and processing when no plugin listens to this
diff --git a/src/main/java/net/minecraft/server/BlockPlant.java b/src/main/java/net/minecraft/server/BlockPlant.java
index 0e4037ea21..736f794fd1 100644
index 0e4037ea21..317ae16347 100644
--- a/src/main/java/net/minecraft/server/BlockPlant.java
+++ b/src/main/java/net/minecraft/server/BlockPlant.java
@@ -15,7 +15,7 @@ public class BlockPlant extends Block {
@ -14,7 +14,7 @@ index 0e4037ea21..736f794fd1 100644
// CraftBukkit start
if (!iblockdata.canPlace(generatoraccess, blockposition)) {
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) {
+ if (generatoraccess instanceof WorldServer && ((WorldServer) generatoraccess).hasPhysicsEvent && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) { // Paper
+ if (!(generatoraccess instanceof WorldServer && ((WorldServer) generatoraccess).hasPhysicsEvent) || !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) { // Paper
return Blocks.AIR.getBlockData();
}
}
@ -78,5 +78,5 @@ index aaeb888a8c..639068d2dc 100644
public EntityTracker tracker;
private final PlayerChunkMap manager;
--
2.20.1
2.21.0