Paper/Spigot-Server-Patches/0062-Remove-Metadata-on-reload.patch
Shane Freeder 276afaa2ea
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
c2d72c82 SPIGOT-3102: Add EXPLOSION SpawnReason

CraftBukkit Changes:
fca41573 SPIGOT-5136: EntityPortalEvent getting called on interdimensional entity teleports
604c8bf0 SPIGOT-3102: Add EXPLOSION SpawnReason
375969a6 Re-add chunk GC for plugin chunk loads
58151368 SPIGOT-5123: Snapshot tile entities can end up with a non-null world
491c8482 SPIGOT-5130: PersistentDataContainer not removing values on TileEntities

Spigot Changes:
d05d3c1f Rebuild patches
2019-07-05 03:13:38 +01:00

35 lines
1.3 KiB
Diff

From 502480c4124674193286dbae28552fca7c481b12 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 13:50:14 -0400
Subject: [PATCH] Remove Metadata on reload
Metadata is not meant to persist reload as things break badly with non primitive types
This will remove metadata on reload so it does not crash everything if a plugin uses it.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 20bd804bce..5d50baa038 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -800,8 +800,18 @@ public final class CraftServer implements Server {
world.paperConfig.init(); // Paper
}
+ Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
pluginManager.clearPlugins();
commandMap.clearCommands();
+
+ // Paper start
+ for (Plugin plugin : pluginClone) {
+ entityMetadata.removeAll(plugin);
+ worldMetadata.removeAll(plugin);
+ playerMetadata.removeAll(plugin);
+ }
+ // Paper end
+
resetRecipes();
reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
--
2.22.0