Paper/Spigot-Server-Patches/0062-Remove-Metadata-on-reload.patch
Shane Freeder 77b05b9c8e
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:
6a4242cb #468: Allow delegation of certain elements to Vanilla when using a custom ChunkGenerator
c6697f90 SPIGOT-5559: Add EntityPotionEffectEvent causes for PATROL_CAPTAIN and WITHER_ROSE
9c1fa040 #467: Add method to remove a recipe by its key
3961d1aa Add nb-configuration.xml to .gitignore

CraftBukkit Changes:
d70084e5 Remove unused seed in CustomChunkGenerator
8a66d4c7 #619: Allow delegation of certain elements to Vanilla when using a custom ChunkGenerator
c2dc19d3 Craftbukkit -> CraftBukkit
ae45e092 SPIGOT-5559: Add EntityPotionEffectEvent causes for bee, raiders and wither rose
00980376 #618: Add method to remove a recipe by its key

Spigot Changes:
c574e08b Rebuild patches
13c24cc4 Rebuild patches
2020-02-02 11:53:48 +00:00

35 lines
1.3 KiB
Diff

From b098719121fc98fcaf4d0640e38972bd497722e7 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 117b349c0..1cfdfcdd3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -803,8 +803,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.25.0