Yatopia/patches/server/0057-Configurable-BlockPhysicsEvent.patch
Ivan Pekov adb131f051
Updated Upstream and Sidestream(s) (Tuinity/EMC/Purpur/AirplaneLite)
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.

Tuinity Changes:
2325c36 Updated Upstream (Paper)

EMC Changes:
a841b5a5 Fix more lore/item name issues (fixes witch gem issue)
1abb3fae Ensure server conversions on ExactChoice ingredients
f2f9d2b0 Forgot to commit paper ref
388620d5 Updated Paper
7a0ae67b Add a null check for UUID to prevent npe later
9de409e0 Updated Paper
0d09eb9a Add new Empire Server API for managing fake players for the tablist

Purpur Changes:
da95725 Updated Upstream (Tuinity)
7194a16 Updated Upstream (Paper)
77373ea Updated Upstream (Tuinity)
0bae78d Drop async advancements patch for now

AirplaneLite Changes:
7b4acbe h != k
a07e80c Whoops, missed paperclip change
845c191 Add license to patch files
fa671b7 Allow gradle wrapper in gitignore
04fc820 Rework strip raytracing patch
f48f6b2 Updated Upstream (Tuinity)
ec7c6df Fix encoding
9326301 Update upstream, fix utf8
20b8c79 Allow gradle wrapper in gitignore
6cd80e9 Updated Upstream (Tuinity)
2021-01-03 13:41:36 +02:00

36 lines
2.5 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 c7031706ea51dd6d8c22c10fab2ce3154daac361..f4ca05cc77ae5ea47db51770f316413fdf8a728b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1412,7 +1412,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
TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper
this.methodProfiler.a(() -> {
diff --git a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
index 5578f5784a87019d3f091173b25b5ec1cc059fd6..4f99aa4b578333795296da2424f38aae65a808a3 100644
--- a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
+++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
@@ -268,4 +268,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);
+ }
}