Yatopia/patches/server/0049-Configurable-BlockPhysicsEvent.patch
Simon Gardling 679a88af3f
Upstream (#447)
* Updated Upstream and Sidestream(s) (Paper/Airplane/Purpur/Empirecraft)

Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Paper Changes:
4b78c0b80 [CI-SKIP] [Auto] Rebuild Patches
2d9ff13eb forced whitelist: use configuable kick message (fixes #5417) (#5418)
000cec2ab bug #5432 - post modern event even if legacy event is cancelled
6c83bc6e5 Remove from Map by key
857852c28 Make sure to remove correct TE during TE tick
f7b4abb25 [Auto] Updated Upstream (Bukkit/CraftBukkit)

Airplane Changes:
9a4bd85 Remove Multithreaded Tracker
1068498 Updated Upstream (Tuinity)

Purpur Changes:
083a86e [ci-skip] Update for Toothpick changes
8b9b214 Updated Upstream (Paper & Tuinity)

Empirecraft Changes:
6b5cffc2 Updated Paper

* Updated Upstream and Sidestream(s) (Airplane/Purpur)

Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Airplane Changes:
3ed988c Use AIR library for configuration parsing

Purpur Changes:
9631959 Add 5 sec TPS to GUI (#260)
2a0a5e6 [ci-skip] Bump Toothpick Kotlin version
02b3444 Add back multithreaded entity tracker
43b4a2f Updated Upstream (Paper & Airplane)

* update gradle from 6.8.2 to 6.8.3

* fix build (hopefully)

* Updated Upstream and Sidestream(s) (Paper)

Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Paper Changes:
211f8e041 Prevent light queue overfill when no players are online

* well that was dumb

* FINALLY it works

* Updated Upstream and Sidestream(s) (Empirecraft)

Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Empirecraft Changes:
018fcff7 Updated Paper
2021-04-03 15:49:43 -04:00

36 lines
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mykyta Komarnytskyy <nkomarn@hotmail.com>
Date: Sat, 24 Oct 2020 21:12:45 -0500
Subject: [PATCH] Configurable BlockPhysicsEvent
Bukkit's BlockPhysicsEvent is *ridiculously* spammy and can easily rack in 1,600 calls/sec on a server with just one player. This hogs a ton of CPU time.
Paper does alleviate this quite well by only firing if plugins are listening, but a lot of common world protection plugins use this event do not offer toggles for their listeners, which makes Paper's change ineffective for most servers.
This patch implements a hard toggle for the event.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 57df64bb8ff906f035d50646678d194173864ded..e7388faeda8ba564ac003e6b5d10c7d50f018b2c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1537,7 +1537,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();
- worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
+ worldserver.hasPhysicsEvent = org.yatopiamc.yatopia.server.YatopiaConfig.fireBlockPhysicsEvent && org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper // Yatopia
worldserver.hasEntityMoveEvent = EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
worldserver.hasRidableMoveEvent = net.pl3x.purpur.event.entity.RidableMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur
TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper
diff --git a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
index 2100ac9c1f4d0df75347579cc5d58255b77ec252..4d6410401457afe91457ae72df14bf687e9c62fd 100644
--- a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
+++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
@@ -245,4 +245,8 @@ public class YatopiaConfig {
criterionTriggerTick = getBoolean("settings.criterion-triggers.tick", true);
}
+ public static boolean fireBlockPhysicsEvent = true;
+ private static void fireBlockPhysicsEvent() {
+ fireBlockPhysicsEvent = getBoolean("settings.fire-block-physics-event", true);
+ }
}