mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-15 15:16:37 +01:00
c1a03b89af
* Updated Upstream and Sidestream(s) (Paper/Tuinity/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: fbae9dbe0 [Auto] Updated Upstream (Bukkit/CraftBukkit) ac4a33aab [Auto] Updated Upstream (Bukkit) c1e07158b [Auto] Updated Upstream (Bukkit/CraftBukkit) 5e4b88e95 Fix dangling sout 23afda179 basic hostname validation 0fb8bdf0e Updated Upstream (Bukkit/CraftBukkit) (#5508) 88ab784da [Auto] Updated Upstream (CraftBukkit) ca7111d5f Fix PlayerItemConsumeEvent cancelling (fixes #4682) (#5383) 06fb560dc Add support for tab completing and highlighting console input from the Brigadier command tree (#5437) 0a9b89c7a Fix occasional light gen issues for neighbor blocks (#5500) a08be1ec7 [Auto] Updated Upstream (CraftBukkit) Tuinity Changes: 7d36676 Fix light source locking f1ec0c2 Add concurrency check to ProtoChunk light sources 159d146 Improvements to chunk loader system Airplane Changes: 3b3cde7 Correctly use DEAR values, fix config reloading dd60919 Updated Upstream (Tuinity) Purpur Changes: 5674cdc Updated Upstream (Paper) Empirecraft Changes: efda8c5b Updated Paper * Updated Upstream and Sidestream(s) (Paper/Tuinity) 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: 39bf5b525 Update teams known as code owners Tuinity Changes: b12d0cc Replace ticket level propagator 42df8e1 Correctly handle recursion for chunkholder updates 73eb2a8 Do not copy visible chunks 8a4f3be Do not schedule poi task for each block write on chunk gen * Multithreaded Entity Tracker fixup
68 lines
3.5 KiB
Diff
68 lines
3.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: ishland <ishlandmc@yeah.net>
|
|
Date: Wed, 27 Jan 2021 20:16:47 +0800
|
|
Subject: [PATCH] Preload ProtocolLib EnumWrappers
|
|
|
|
Currently, ProtocolLib load EnumWrappers lazily and causing memory effects issues. This patch preloads EnumWrappers to prevent further NPE.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index ee0b256632e23bc18f94cbcf478e9dc7fc2c50e9..95922cdce7483f215aa139f280e20a8858955879 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1088,6 +1088,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
// Paper end
|
|
|
|
PaperJvmChecker.checkJvm(); // Paper jvm version nag
|
|
+ if (org.yatopiamc.yatopia.server.YatopiaConfig.fixProtocolLib) org.yatopiamc.yatopia.server.util.YatopiaPreloadProtocolLib.run(); // Yatopia
|
|
com.tuinity.tuinity.config.TuinityConfig.createWorldSections = false; // Tuinity - don't let plugin created worlds fill our config
|
|
org.spigotmc.WatchdogThread.tick(); // Paper
|
|
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
|
diff --git a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
|
|
index c2dc5265552ebd429111253c70481003a4be29dd..15e2fa125bc293b954cceb5b1fbcec7fade3e4db 100644
|
|
--- a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
|
|
+++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
|
|
@@ -271,4 +271,9 @@ public class YatopiaConfig {
|
|
logPlayerLoginLoc = getBoolean("settings.log-player-login-location", logPlayerLoginLoc);
|
|
}
|
|
|
|
+ public static boolean fixProtocolLib = true;
|
|
+ private static void protocolLib() {
|
|
+ fixProtocolLib = getBoolean("settings.fix-protocollib", fixProtocolLib);
|
|
+ }
|
|
+
|
|
}
|
|
diff --git a/src/main/java/org/yatopiamc/yatopia/server/util/YatopiaPreloadProtocolLib.java b/src/main/java/org/yatopiamc/yatopia/server/util/YatopiaPreloadProtocolLib.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..85906aa00163a4626b16190e2e48385bc5eba801
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/yatopiamc/yatopia/server/util/YatopiaPreloadProtocolLib.java
|
|
@@ -0,0 +1,28 @@
|
|
+package org.yatopiamc.yatopia.server.util;
|
|
+
|
|
+import net.minecraft.server.MinecraftServer;
|
|
+import org.bukkit.Bukkit;
|
|
+import org.bukkit.plugin.Plugin;
|
|
+import org.bukkit.plugin.SimplePluginManager;
|
|
+
|
|
+import java.lang.reflect.Method;
|
|
+
|
|
+public class YatopiaPreloadProtocolLib {
|
|
+
|
|
+ public synchronized static void run() {
|
|
+ try {
|
|
+ final SimplePluginManager pluginManager = (SimplePluginManager) Bukkit.getPluginManager();
|
|
+ final Plugin protocolLib = pluginManager.getPlugin("ProtocolLib");
|
|
+ if(protocolLib != null && protocolLib.isEnabled()) {
|
|
+ MinecraftServer.LOGGER.info("Yatopia: Attempting to fix ProtocolLib");
|
|
+ final Method initialize = Class.forName("com.comphenix.protocol.wrappers.EnumWrappers", true, protocolLib.getClass().getClassLoader()).getDeclaredMethod("initialize");
|
|
+ initialize.setAccessible(true);
|
|
+ initialize.invoke(null);
|
|
+ synchronized (YatopiaPreloadProtocolLib.class) {
|
|
+ }
|
|
+ }
|
|
+ } catch (Throwable t) {
|
|
+ MinecraftServer.LOGGER.warn("Unable to fix ProtocolLib", t);
|
|
+ }
|
|
+ }
|
|
+}
|