From 3c1cd3bdf2a393695086f665f708b93f459902a4 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Sat, 12 Jun 2021 13:18:01 +0200 Subject: [PATCH] More more work --- ...or-plugins-modifying-the-parent-of-t.patch | 234 +++++++++--------- .../0054-PlayerAttemptPickupItemEvent.patch | 0 .../0055-Add-UnknownCommandEvent.patch | 0 .../0056-Basic-PlayerProfile-API.patch | 4 +- ...layerPickupItemEvent-setFlyAtPlayer.patch} | 6 +- .../0058-Shoulder-Entities-Release-API.patch} | 2 +- .../0059-Entity-fromMobSpawner.patch | 0 .../0060-Profile-Lookup-Events.patch} | 0 ...1-Improve-the-Saddle-API-for-Horses.patch} | 0 .../0062-Add-getI18NDisplayName-API.patch | 14 +- .../0063-ensureServerConversions-API.patch} | 21 +- .../0064-Make-plugins-list-alphabetical.patch | 0 .../0065-LivingEntity-setKiller.patch | 0 .../0066-ProfileWhitelistVerifyEvent.patch} | 0 ...low-plugins-to-use-SLF4J-for-logging.patch | 30 +-- ...fixes-in-implementation-logging-con.patch} | 0 ...or-plugins-modifying-the-parent-of-t.patch | 117 +++++++++ ...66-Fix-MC-117075-TE-Unload-Lag-Spike.patch | 0 ...imer-when-spawner-event-is-cancelled.patch | 27 -- .../0141-PlayerAttemptPickupItemEvent.patch} | 6 +- .../0142-Add-UnknownCommandEvent.patch} | 4 +- .../0143-Basic-PlayerProfile-API.patch} | 61 ++--- .../0144-Shoulder-Entities-Release-API.patch} | 10 +- .../0145-Profile-Lookup-Events.patch} | 0 ...layer-logins-during-server-shutdown.patch} | 4 +- .../0147-Entity-fromMobSpawner.patch} | 34 +-- ...8-Improve-the-Saddle-API-for-Horses.patch} | 4 +- ...plement-ensureServerConversions-API.patch} | 4 +- .../0150-Implement-getI18NDisplayName.patch} | 28 +-- .../0151-ProfileWhitelistVerifyEvent.patch} | 10 +- .../0152-Fix-this-stupid-bullshit.patch} | 6 +- .../0153-LivingEntity-setKiller.patch} | 10 +- ...wns-should-honor-nametags-and-leash.patch} | 4 +- ...imer-when-spawner-event-is-cancelled.patch | 27 ++ ...a-custom-authentication-servers-dow.patch} | 4 +- 35 files changed, 375 insertions(+), 296 deletions(-) rename patches/{api-unmapped => api}/0054-PlayerAttemptPickupItemEvent.patch (100%) rename patches/{api-unmapped => api}/0055-Add-UnknownCommandEvent.patch (100%) rename patches/{api-unmapped => api}/0056-Basic-PlayerProfile-API.patch (98%) rename patches/api/{0151-PlayerPickupItemEvent-setFlyAtPlayer.patch => 0057-PlayerPickupItemEvent-setFlyAtPlayer.patch} (99%) rename patches/{api-unmapped/0057-Shoulder-Entities-Release-API.patch => api/0058-Shoulder-Entities-Release-API.patch} (92%) rename patches/{api-unmapped => api}/0059-Entity-fromMobSpawner.patch (100%) rename patches/{api-unmapped/0058-Profile-Lookup-Events.patch => api/0060-Profile-Lookup-Events.patch} (100%) rename patches/{api-unmapped/0060-Improve-the-Saddle-API-for-Horses.patch => api/0061-Improve-the-Saddle-API-for-Horses.patch} (100%) rename patches/{api-unmapped => api}/0062-Add-getI18NDisplayName-API.patch (76%) rename patches/{api-unmapped/0061-ensureServerConversions-API.patch => api/0063-ensureServerConversions-API.patch} (80%) rename patches/{api-unmapped => api}/0064-Make-plugins-list-alphabetical.patch (100%) rename patches/{api-unmapped => api}/0065-LivingEntity-setKiller.patch (100%) rename patches/{api-unmapped/0063-ProfileWhitelistVerifyEvent.patch => api/0066-ProfileWhitelistVerifyEvent.patch} (100%) rename patches/{api-unmapped => api}/0067-Allow-plugins-to-use-SLF4J-for-logging.patch (69%) rename patches/{api-unmapped/0066-Handle-plugin-prefixes-in-implementation-logging-con.patch => api/0068-Handle-plugin-prefixes-in-implementation-logging-con.patch} (100%) create mode 100644 patches/api/0069-Add-workaround-for-plugins-modifying-the-parent-of-t.patch rename patches/{server-remapped => removed/1.17}/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch (100%) delete mode 100644 patches/server-remapped/0165-Reset-spawner-timer-when-spawner-event-is-cancelled.patch rename patches/{server-remapped/0152-PlayerAttemptPickupItemEvent.patch => server/0141-PlayerAttemptPickupItemEvent.patch} (88%) rename patches/{server-remapped/0153-Add-UnknownCommandEvent.patch => server/0142-Add-UnknownCommandEvent.patch} (87%) rename patches/{server-remapped/0154-Basic-PlayerProfile-API.patch => server/0143-Basic-PlayerProfile-API.patch} (89%) rename patches/{server-remapped/0155-Shoulder-Entities-Release-API.patch => server/0144-Shoulder-Entities-Release-API.patch} (89%) rename patches/{server-remapped/0156-Profile-Lookup-Events.patch => server/0145-Profile-Lookup-Events.patch} (100%) rename patches/{server-remapped/0157-Block-player-logins-during-server-shutdown.patch => server/0146-Block-player-logins-during-server-shutdown.patch} (87%) rename patches/{server-remapped/0158-Entity-fromMobSpawner.patch => server/0147-Entity-fromMobSpawner.patch} (60%) rename patches/{server-remapped/0159-Improve-the-Saddle-API-for-Horses.patch => server/0148-Improve-the-Saddle-API-for-Horses.patch} (94%) rename patches/{server-remapped/0160-Implement-ensureServerConversions-API.patch => server/0149-Implement-ensureServerConversions-API.patch} (87%) rename patches/{server-remapped/0161-Implement-getI18NDisplayName.patch => server/0150-Implement-getI18NDisplayName.patch} (59%) rename patches/{server-remapped/0162-ProfileWhitelistVerifyEvent.patch => server/0151-ProfileWhitelistVerifyEvent.patch} (85%) rename patches/{server-remapped/0163-Fix-this-stupid-bullshit.patch => server/0152-Fix-this-stupid-bullshit.patch} (88%) rename patches/{server-remapped/0168-LivingEntity-setKiller.patch => server/0153-LivingEntity-setKiller.patch} (82%) rename patches/{server-remapped/0164-Ocelot-despawns-should-honor-nametags-and-leash.patch => server/0154-Ocelot-despawns-should-honor-nametags-and-leash.patch} (85%) create mode 100644 patches/server/0155-Reset-spawner-timer-when-spawner-event-is-cancelled.patch rename patches/{server-remapped/0167-Allow-specifying-a-custom-authentication-servers-dow.patch => server/0156-Allow-specifying-a-custom-authentication-servers-dow.patch} (94%) diff --git a/patches/api-unmapped/0068-Add-workaround-for-plugins-modifying-the-parent-of-t.patch b/patches/api-unmapped/0068-Add-workaround-for-plugins-modifying-the-parent-of-t.patch index 47b6099ab7..f0cce6b67a 100644 --- a/patches/api-unmapped/0068-Add-workaround-for-plugins-modifying-the-parent-of-t.patch +++ b/patches/api-unmapped/0068-Add-workaround-for-plugins-modifying-the-parent-of-t.patch @@ -1,117 +1,117 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Minecrell -Date: Thu, 21 Sep 2017 19:41:20 +0200 -Subject: [PATCH] Add workaround for plugins modifying the parent of the plugin - logger - -Essentials uses a custom logger name ("Essentials") instead of the -plugin logger. Log messages are redirected to the plugin logger by -setting the parent of the "Essentials" logger to the plugin logger. - -With our changes, the plugin logger is now also called "Essentials", -resulting in an infinite loop. Make sure plugins can't change the -parent of the plugin logger to avoid this. - -diff --git a/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java -new file mode 100644 -index 0000000000000000000000000000000000000000..76f2cb9cd99cad2a9484eab2becd8c36f1dd91b3 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java -@@ -0,0 +1,41 @@ -+package com.destroystokyo.paper.utils; -+ -+import org.bukkit.plugin.PluginDescriptionFile; -+ -+import java.util.logging.Level; -+import java.util.logging.LogManager; -+import java.util.logging.Logger; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Prevents plugins (e.g. Essentials) from changing the parent of the plugin logger. -+ */ -+public class PaperPluginLogger extends Logger { -+ -+ @NotNull -+ public static Logger getLogger(@NotNull PluginDescriptionFile description) { -+ Logger logger = new PaperPluginLogger(description); -+ if (!LogManager.getLogManager().addLogger(logger)) { -+ // Disable this if it's going to happen across reloads anyways... -+ //logger.log(Level.WARNING, "Could not insert plugin logger - one was already found: {}", LogManager.getLogManager().getLogger(this.getName())); -+ logger = LogManager.getLogManager().getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); -+ } -+ -+ return logger; -+ } -+ -+ private PaperPluginLogger(@NotNull PluginDescriptionFile description) { -+ super(description.getPrefix() != null ? description.getPrefix() : description.getName(), null); -+ } -+ -+ @Override -+ public void setParent(@NotNull Logger parent) { -+ if (getParent() != null) { -+ warning("Ignoring attempt to change parent of plugin logger"); -+ } else { -+ this.log(Level.FINE, "Setting plugin logger parent to {0}", parent); -+ super.setParent(parent); -+ } -+ } -+ -+} -diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -index bb2e55e97bf887a28cac7d4f9a0a23960d22cf56..04fa3991f6ce4e9dad804f28fc6c947695857089 100644 ---- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -@@ -42,7 +42,7 @@ public abstract class JavaPlugin extends PluginBase { - private boolean naggable = true; - private FileConfiguration newConfig = null; - private File configFile = null; -- private Logger logger = null; // Paper - PluginLogger -> Logger -+ Logger logger = null; // Paper - PluginLogger -> Logger, package-private - - public JavaPlugin() { - final ClassLoader classLoader = this.getClass().getClassLoader(); -@@ -276,8 +276,11 @@ public abstract class JavaPlugin extends PluginBase { - this.dataFolder = dataFolder; - this.classLoader = classLoader; - this.configFile = new File(dataFolder, "config.yml"); -- // Paper - Handle plugin prefix in implementation -- this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); -+ // Paper start -+ if (this.logger == null) { -+ this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(this.description); -+ } -+ // Paper end - } - - /** -diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index 13100c688bfccb826b3072aaa92901f8634cf9ab..b9766b9b47547c400ed075f1635bb1461cb5e860 100644 ---- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -44,6 +44,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot - private JavaPlugin pluginInit; - private IllegalStateException pluginState; - private final Set seenIllegalAccess = Collections.newSetFromMap(new ConcurrentHashMap<>()); -+ private java.util.logging.Logger logger; // Paper - add field - - static { - ClassLoader.registerAsParallelCapable(); -@@ -62,6 +63,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot - this.url = file.toURI().toURL(); - this.libraryLoader = libraryLoader; - -+ this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(description); // Paper - Register logger early -+ - try { - Class jarClass; - try { -@@ -222,6 +225,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot - pluginState = new IllegalStateException("Initial initialization"); - this.pluginInit = javaPlugin; - -+ javaPlugin.logger = this.logger; // Paper - set logger - javaPlugin.init(loader, loader.server, description, dataFolder, file, this); - } - } +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Minecrell +Date: Thu, 21 Sep 2017 19:41:20 +0200 +Subject: [PATCH] Add workaround for plugins modifying the parent of the plugin + logger + +Essentials uses a custom logger name ("Essentials") instead of the +plugin logger. Log messages are redirected to the plugin logger by +setting the parent of the "Essentials" logger to the plugin logger. + +With our changes, the plugin logger is now also called "Essentials", +resulting in an infinite loop. Make sure plugins can't change the +parent of the plugin logger to avoid this. + +diff --git a/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java +new file mode 100644 +index 0000000000000000000000000000000000000000..76f2cb9cd99cad2a9484eab2becd8c36f1dd91b3 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java +@@ -0,0 +1,41 @@ ++package com.destroystokyo.paper.utils; ++ ++import org.bukkit.plugin.PluginDescriptionFile; ++ ++import java.util.logging.Level; ++import java.util.logging.LogManager; ++import java.util.logging.Logger; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Prevents plugins (e.g. Essentials) from changing the parent of the plugin logger. ++ */ ++public class PaperPluginLogger extends Logger { ++ ++ @NotNull ++ public static Logger getLogger(@NotNull PluginDescriptionFile description) { ++ Logger logger = new PaperPluginLogger(description); ++ if (!LogManager.getLogManager().addLogger(logger)) { ++ // Disable this if it's going to happen across reloads anyways... ++ //logger.log(Level.WARNING, "Could not insert plugin logger - one was already found: {}", LogManager.getLogManager().getLogger(this.getName())); ++ logger = LogManager.getLogManager().getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); ++ } ++ ++ return logger; ++ } ++ ++ private PaperPluginLogger(@NotNull PluginDescriptionFile description) { ++ super(description.getPrefix() != null ? description.getPrefix() : description.getName(), null); ++ } ++ ++ @Override ++ public void setParent(@NotNull Logger parent) { ++ if (getParent() != null) { ++ warning("Ignoring attempt to change parent of plugin logger"); ++ } else { ++ this.log(Level.FINE, "Setting plugin logger parent to {0}", parent); ++ super.setParent(parent); ++ } ++ } ++ ++} +diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +index bb2e55e97bf887a28cac7d4f9a0a23960d22cf56..04fa3991f6ce4e9dad804f28fc6c947695857089 100644 +--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java ++++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +@@ -42,7 +42,7 @@ public abstract class JavaPlugin extends PluginBase { + private boolean naggable = true; + private FileConfiguration newConfig = null; + private File configFile = null; +- private Logger logger = null; // Paper - PluginLogger -> Logger ++ Logger logger = null; // Paper - PluginLogger -> Logger, package-private + + public JavaPlugin() { + final ClassLoader classLoader = this.getClass().getClassLoader(); +@@ -276,8 +276,11 @@ public abstract class JavaPlugin extends PluginBase { + this.dataFolder = dataFolder; + this.classLoader = classLoader; + this.configFile = new File(dataFolder, "config.yml"); +- // Paper - Handle plugin prefix in implementation +- this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); ++ // Paper start ++ if (this.logger == null) { ++ this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(this.description); ++ } ++ // Paper end + } + + /** +diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +index 13100c688bfccb826b3072aaa92901f8634cf9ab..b9766b9b47547c400ed075f1635bb1461cb5e860 100644 +--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +@@ -44,6 +44,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + private JavaPlugin pluginInit; + private IllegalStateException pluginState; + private final Set seenIllegalAccess = Collections.newSetFromMap(new ConcurrentHashMap<>()); ++ private java.util.logging.Logger logger; // Paper - add field + + static { + ClassLoader.registerAsParallelCapable(); +@@ -62,6 +63,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + this.url = file.toURI().toURL(); + this.libraryLoader = libraryLoader; + ++ this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(description); // Paper - Register logger early ++ + try { + Class jarClass; + try { +@@ -222,6 +225,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + pluginState = new IllegalStateException("Initial initialization"); + this.pluginInit = javaPlugin; + ++ javaPlugin.logger = this.logger; // Paper - set logger + javaPlugin.init(loader, loader.server, description, dataFolder, file, this); + } + } diff --git a/patches/api-unmapped/0054-PlayerAttemptPickupItemEvent.patch b/patches/api/0054-PlayerAttemptPickupItemEvent.patch similarity index 100% rename from patches/api-unmapped/0054-PlayerAttemptPickupItemEvent.patch rename to patches/api/0054-PlayerAttemptPickupItemEvent.patch diff --git a/patches/api-unmapped/0055-Add-UnknownCommandEvent.patch b/patches/api/0055-Add-UnknownCommandEvent.patch similarity index 100% rename from patches/api-unmapped/0055-Add-UnknownCommandEvent.patch rename to patches/api/0055-Add-UnknownCommandEvent.patch diff --git a/patches/api-unmapped/0056-Basic-PlayerProfile-API.patch b/patches/api/0056-Basic-PlayerProfile-API.patch similarity index 98% rename from patches/api-unmapped/0056-Basic-PlayerProfile-API.patch rename to patches/api/0056-Basic-PlayerProfile-API.patch index 1c7a3ce8f5..e39405a942 100644 --- a/patches/api-unmapped/0056-Basic-PlayerProfile-API.patch +++ b/patches/api/0056-Basic-PlayerProfile-API.patch @@ -267,7 +267,7 @@ index 0000000000000000000000000000000000000000..7b3b6ef533d32169fbeca389bd61cfc6 + } +} diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index e2052baa65ed3525a89b26c065b3e2a58916ab99..39942b4c5683f2dcc40be5a23af36a3bb32badb1 100644 +index 14786ce10f43cd203544750a073c5efaf8b21348..c9f00ffe05c8624619b23ad22cf61233cede440e 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -1778,6 +1778,40 @@ public final class Bukkit { @@ -312,7 +312,7 @@ index e2052baa65ed3525a89b26c065b3e2a58916ab99..39942b4c5683f2dcc40be5a23af36a3b @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 8fd026e4ffcdf009365ae04b87f7559bed32c7d3..0c1fbaee08cb614dfdd1de0200dfa7fa351fc52d 100644 +index 7c44e23a5c370537d5163fd6ea6a1dea4d19d2b7..f2448c6dc8ef64393127a13c33eb14b0d5cd92c0 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1562,5 +1562,33 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi diff --git a/patches/api/0151-PlayerPickupItemEvent-setFlyAtPlayer.patch b/patches/api/0057-PlayerPickupItemEvent-setFlyAtPlayer.patch similarity index 99% rename from patches/api/0151-PlayerPickupItemEvent-setFlyAtPlayer.patch rename to patches/api/0057-PlayerPickupItemEvent-setFlyAtPlayer.patch index fbc15c2f8c..353d395911 100644 --- a/patches/api/0151-PlayerPickupItemEvent-setFlyAtPlayer.patch +++ b/patches/api/0057-PlayerPickupItemEvent-setFlyAtPlayer.patch @@ -15,11 +15,11 @@ index 951ea2cc763973655beedcba3c75332d3f297313..18d82c111f30e0279c10a174a51bac01 + private boolean flyAtPlayer = true; // Paper private boolean cancel = false; private final int remaining; - + @@ -45,6 +46,27 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable { return remaining; } - + + // Paper Start + /** + * Set if the item will fly at the player @@ -50,5 +50,5 @@ index 951ea2cc763973655beedcba3c75332d3f297313..18d82c111f30e0279c10a174a51bac01 this.cancel = cancel; + this.flyAtPlayer = !cancel; // Paper } - + @NotNull diff --git a/patches/api-unmapped/0057-Shoulder-Entities-Release-API.patch b/patches/api/0058-Shoulder-Entities-Release-API.patch similarity index 92% rename from patches/api-unmapped/0057-Shoulder-Entities-Release-API.patch rename to patches/api/0058-Shoulder-Entities-Release-API.patch index 249e81f7ad..54cea09655 100644 --- a/patches/api-unmapped/0057-Shoulder-Entities-Release-API.patch +++ b/patches/api/0058-Shoulder-Entities-Release-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Shoulder Entities Release API diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 72178c3036f567ceaf15016978a9737eb9c4afc4..d212d5123b6294f7873d72f125505a006c290b05 100644 +index b64e1f5e5aa4ec9bdd5f6976bf9dfdb83398e305..8ba6a59066234b834aedb0fb414ee7391aa2ac18 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java @@ -300,6 +300,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder diff --git a/patches/api-unmapped/0059-Entity-fromMobSpawner.patch b/patches/api/0059-Entity-fromMobSpawner.patch similarity index 100% rename from patches/api-unmapped/0059-Entity-fromMobSpawner.patch rename to patches/api/0059-Entity-fromMobSpawner.patch diff --git a/patches/api-unmapped/0058-Profile-Lookup-Events.patch b/patches/api/0060-Profile-Lookup-Events.patch similarity index 100% rename from patches/api-unmapped/0058-Profile-Lookup-Events.patch rename to patches/api/0060-Profile-Lookup-Events.patch diff --git a/patches/api-unmapped/0060-Improve-the-Saddle-API-for-Horses.patch b/patches/api/0061-Improve-the-Saddle-API-for-Horses.patch similarity index 100% rename from patches/api-unmapped/0060-Improve-the-Saddle-API-for-Horses.patch rename to patches/api/0061-Improve-the-Saddle-API-for-Horses.patch diff --git a/patches/api-unmapped/0062-Add-getI18NDisplayName-API.patch b/patches/api/0062-Add-getI18NDisplayName-API.patch similarity index 76% rename from patches/api-unmapped/0062-Add-getI18NDisplayName-API.patch rename to patches/api/0062-Add-getI18NDisplayName-API.patch index e4dde4f260..8af413093e 100644 --- a/patches/api-unmapped/0062-Add-getI18NDisplayName-API.patch +++ b/patches/api/0062-Add-getI18NDisplayName-API.patch @@ -8,13 +8,13 @@ Currently the server only supports the English language. To override this, You must replace the language file embedded in the server jar. diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java -index 44a858490f4db37f979fd487ed7a5b2b8b7f1a3f..3fd56a95de7d4cbeaf5d8554fbc7127a627cb977 100644 +index 6cc4bad2ecd19f44a680ff03cbfb99d48ea5c337..b1fbb931148a87f29e8b8796b13851d767cc1d68 100644 --- a/src/main/java/org/bukkit/inventory/ItemFactory.java +++ b/src/main/java/org/bukkit/inventory/ItemFactory.java -@@ -172,5 +172,16 @@ public interface ItemFactory { +@@ -160,5 +160,16 @@ public interface ItemFactory { */ @NotNull - ItemStack ensureServerConversions(@NotNull ItemStack item); + net.kyori.adventure.text.Component displayName(@NotNull ItemStack itemStack); + + /** + * Gets the Display name as seen in the Client. @@ -29,12 +29,12 @@ index 44a858490f4db37f979fd487ed7a5b2b8b7f1a3f..3fd56a95de7d4cbeaf5d8554fbc7127a // Paper end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 47d8611221967d32b654ddac0fbf0e405ef62352..82bd3e6701dbd7df9f0f8c3801c5ae1baba4eec5 100644 +index a15abec467bac70116a6fc21a300d4930b909f15..de5bcdb7b84acdd5e22500e367df292f35a86e19 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -624,5 +624,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor - public ItemStack ensureServerConversions() { - return Bukkit.getServer().getItemFactory().ensureServerConversions(this); +@@ -611,5 +611,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor + public @NotNull net.kyori.adventure.text.Component displayName() { + return Bukkit.getServer().getItemFactory().displayName(this); } + + /** diff --git a/patches/api-unmapped/0061-ensureServerConversions-API.patch b/patches/api/0063-ensureServerConversions-API.patch similarity index 80% rename from patches/api-unmapped/0061-ensureServerConversions-API.patch rename to patches/api/0063-ensureServerConversions-API.patch index ed64978a06..82e1a82c86 100644 --- a/patches/api-unmapped/0061-ensureServerConversions-API.patch +++ b/patches/api/0063-ensureServerConversions-API.patch @@ -7,13 +7,13 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr to ensure it meets latest minecraft expectations. diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java -index 6cc4bad2ecd19f44a680ff03cbfb99d48ea5c337..42551f8aa6666a6144815b619327c6d8f3c3776b 100644 +index b1fbb931148a87f29e8b8796b13851d767cc1d68..71e5ee496a947fbd8e3ec579833b157c76b51833 100644 --- a/src/main/java/org/bukkit/inventory/ItemFactory.java +++ b/src/main/java/org/bukkit/inventory/ItemFactory.java -@@ -160,5 +160,17 @@ public interface ItemFactory { +@@ -171,5 +171,17 @@ public interface ItemFactory { */ - @NotNull - net.kyori.adventure.text.Component displayName(@NotNull ItemStack itemStack); + @Nullable + String getI18NDisplayName(@Nullable ItemStack item); + + /** + * Minecraft updates are converting simple item stacks into more complex NBT oriented Item Stacks. @@ -29,7 +29,7 @@ index 6cc4bad2ecd19f44a680ff03cbfb99d48ea5c337..42551f8aa6666a6144815b619327c6d8 // Paper end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index a15abec467bac70116a6fc21a300d4930b909f15..f9d226962f16821d07ac80f1bf69cb01a5de2654 100644 +index de5bcdb7b84acdd5e22500e367df292f35a86e19..e8783b0116f4efd5447a5f6f260506000983ffd2 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java @@ -536,7 +536,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor @@ -41,11 +41,10 @@ index a15abec467bac70116a6fc21a300d4930b909f15..f9d226962f16821d07ac80f1bf69cb01 } /** -@@ -611,5 +611,18 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor - public @NotNull net.kyori.adventure.text.Component displayName() { +@@ -612,6 +612,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor return Bukkit.getServer().getItemFactory().displayName(this); } -+ + + /** + * Minecraft updates are converting simple item stacks into more complex NBT oriented Item Stacks. + * @@ -58,5 +57,7 @@ index a15abec467bac70116a6fc21a300d4930b909f15..f9d226962f16821d07ac80f1bf69cb01 + public ItemStack ensureServerConversions() { + return Bukkit.getServer().getItemFactory().ensureServerConversions(this); + } - // Paper end - } ++ + /** + * Gets the Display name as seen in the Client. + * Currently the server only supports the English language. To override this, diff --git a/patches/api-unmapped/0064-Make-plugins-list-alphabetical.patch b/patches/api/0064-Make-plugins-list-alphabetical.patch similarity index 100% rename from patches/api-unmapped/0064-Make-plugins-list-alphabetical.patch rename to patches/api/0064-Make-plugins-list-alphabetical.patch diff --git a/patches/api-unmapped/0065-LivingEntity-setKiller.patch b/patches/api/0065-LivingEntity-setKiller.patch similarity index 100% rename from patches/api-unmapped/0065-LivingEntity-setKiller.patch rename to patches/api/0065-LivingEntity-setKiller.patch diff --git a/patches/api-unmapped/0063-ProfileWhitelistVerifyEvent.patch b/patches/api/0066-ProfileWhitelistVerifyEvent.patch similarity index 100% rename from patches/api-unmapped/0063-ProfileWhitelistVerifyEvent.patch rename to patches/api/0066-ProfileWhitelistVerifyEvent.patch diff --git a/patches/api-unmapped/0067-Allow-plugins-to-use-SLF4J-for-logging.patch b/patches/api/0067-Allow-plugins-to-use-SLF4J-for-logging.patch similarity index 69% rename from patches/api-unmapped/0067-Allow-plugins-to-use-SLF4J-for-logging.patch rename to patches/api/0067-Allow-plugins-to-use-SLF4J-for-logging.patch index 58225ea7be..0555a52329 100644 --- a/patches/api-unmapped/0067-Allow-plugins-to-use-SLF4J-for-logging.patch +++ b/patches/api/0067-Allow-plugins-to-use-SLF4J-for-logging.patch @@ -13,24 +13,18 @@ Expose SLF4J as optional logging API for plugins, so they can use it without having to shade it in the plugin and going through several layers of logging abstraction. -diff --git a/pom.xml b/pom.xml -index 2c757ffb2253748c6a81f9b373290108209b6ff2..8cf6e1f78d4c1ae388bb478700d5dceaab65c4e7 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -144,6 +144,13 @@ - 21.0.1 - provided - -+ -+ -+ org.slf4j -+ slf4j-api -+ 1.7.25 -+ compile -+ - - - junit +diff --git a/build.gradle.kts b/build.gradle.kts +index 9451f8660ec248619383d516df4b95e20e24828a..9657dcb900267cb5cd1ad7a850eb15bc74479314 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -24,6 +24,7 @@ dependencies { + api("net.kyori:adventure-text-serializer-plain") + api("org.ow2.asm:asm:9.0") + api("org.ow2.asm:asm-commons:9.0") ++ api("org.apache.logging.log4j:log4j-api:2.14.1") // Paper + + compileOnly("org.apache.maven:maven-resolver-provider:3.8.1") + compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0") diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java index febfec6efafd76bb59b4b43aa223af16f73339b4..79890c68f1ad31f951dfdbd9a16dac500ec58c40 100644 --- a/src/main/java/org/bukkit/plugin/Plugin.java diff --git a/patches/api-unmapped/0066-Handle-plugin-prefixes-in-implementation-logging-con.patch b/patches/api/0068-Handle-plugin-prefixes-in-implementation-logging-con.patch similarity index 100% rename from patches/api-unmapped/0066-Handle-plugin-prefixes-in-implementation-logging-con.patch rename to patches/api/0068-Handle-plugin-prefixes-in-implementation-logging-con.patch diff --git a/patches/api/0069-Add-workaround-for-plugins-modifying-the-parent-of-t.patch b/patches/api/0069-Add-workaround-for-plugins-modifying-the-parent-of-t.patch new file mode 100644 index 0000000000..47b6099ab7 --- /dev/null +++ b/patches/api/0069-Add-workaround-for-plugins-modifying-the-parent-of-t.patch @@ -0,0 +1,117 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Minecrell +Date: Thu, 21 Sep 2017 19:41:20 +0200 +Subject: [PATCH] Add workaround for plugins modifying the parent of the plugin + logger + +Essentials uses a custom logger name ("Essentials") instead of the +plugin logger. Log messages are redirected to the plugin logger by +setting the parent of the "Essentials" logger to the plugin logger. + +With our changes, the plugin logger is now also called "Essentials", +resulting in an infinite loop. Make sure plugins can't change the +parent of the plugin logger to avoid this. + +diff --git a/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java +new file mode 100644 +index 0000000000000000000000000000000000000000..76f2cb9cd99cad2a9484eab2becd8c36f1dd91b3 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java +@@ -0,0 +1,41 @@ ++package com.destroystokyo.paper.utils; ++ ++import org.bukkit.plugin.PluginDescriptionFile; ++ ++import java.util.logging.Level; ++import java.util.logging.LogManager; ++import java.util.logging.Logger; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Prevents plugins (e.g. Essentials) from changing the parent of the plugin logger. ++ */ ++public class PaperPluginLogger extends Logger { ++ ++ @NotNull ++ public static Logger getLogger(@NotNull PluginDescriptionFile description) { ++ Logger logger = new PaperPluginLogger(description); ++ if (!LogManager.getLogManager().addLogger(logger)) { ++ // Disable this if it's going to happen across reloads anyways... ++ //logger.log(Level.WARNING, "Could not insert plugin logger - one was already found: {}", LogManager.getLogManager().getLogger(this.getName())); ++ logger = LogManager.getLogManager().getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); ++ } ++ ++ return logger; ++ } ++ ++ private PaperPluginLogger(@NotNull PluginDescriptionFile description) { ++ super(description.getPrefix() != null ? description.getPrefix() : description.getName(), null); ++ } ++ ++ @Override ++ public void setParent(@NotNull Logger parent) { ++ if (getParent() != null) { ++ warning("Ignoring attempt to change parent of plugin logger"); ++ } else { ++ this.log(Level.FINE, "Setting plugin logger parent to {0}", parent); ++ super.setParent(parent); ++ } ++ } ++ ++} +diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +index bb2e55e97bf887a28cac7d4f9a0a23960d22cf56..04fa3991f6ce4e9dad804f28fc6c947695857089 100644 +--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java ++++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +@@ -42,7 +42,7 @@ public abstract class JavaPlugin extends PluginBase { + private boolean naggable = true; + private FileConfiguration newConfig = null; + private File configFile = null; +- private Logger logger = null; // Paper - PluginLogger -> Logger ++ Logger logger = null; // Paper - PluginLogger -> Logger, package-private + + public JavaPlugin() { + final ClassLoader classLoader = this.getClass().getClassLoader(); +@@ -276,8 +276,11 @@ public abstract class JavaPlugin extends PluginBase { + this.dataFolder = dataFolder; + this.classLoader = classLoader; + this.configFile = new File(dataFolder, "config.yml"); +- // Paper - Handle plugin prefix in implementation +- this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); ++ // Paper start ++ if (this.logger == null) { ++ this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(this.description); ++ } ++ // Paper end + } + + /** +diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +index 13100c688bfccb826b3072aaa92901f8634cf9ab..b9766b9b47547c400ed075f1635bb1461cb5e860 100644 +--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +@@ -44,6 +44,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + private JavaPlugin pluginInit; + private IllegalStateException pluginState; + private final Set seenIllegalAccess = Collections.newSetFromMap(new ConcurrentHashMap<>()); ++ private java.util.logging.Logger logger; // Paper - add field + + static { + ClassLoader.registerAsParallelCapable(); +@@ -62,6 +63,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + this.url = file.toURI().toURL(); + this.libraryLoader = libraryLoader; + ++ this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(description); // Paper - Register logger early ++ + try { + Class jarClass; + try { +@@ -222,6 +225,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + pluginState = new IllegalStateException("Initial initialization"); + this.pluginInit = javaPlugin; + ++ javaPlugin.logger = this.logger; // Paper - set logger + javaPlugin.init(loader, loader.server, description, dataFolder, file, this); + } + } diff --git a/patches/server-remapped/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch b/patches/removed/1.17/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch similarity index 100% rename from patches/server-remapped/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch rename to patches/removed/1.17/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch diff --git a/patches/server-remapped/0165-Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/patches/server-remapped/0165-Reset-spawner-timer-when-spawner-event-is-cancelled.patch deleted file mode 100644 index 3476f2d837..0000000000 --- a/patches/server-remapped/0165-Reset-spawner-timer-when-spawner-event-is-cancelled.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Mon, 31 Jul 2017 01:45:19 -0500 -Subject: [PATCH] Reset spawner timer when spawner event is cancelled - - -diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 7541155048744a9af2017ec039cf99a246addb0b..4582fc1bb767214241568fbc22b0ee2cbf3322e0 100644 ---- a/src/main/java/net/minecraft/world/level/BaseSpawner.java -+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -161,6 +161,7 @@ public abstract class BaseSpawner { - // Spigot End - } - entity.spawnedViaMobSpawner = true; // Paper -+ flag = true; // Paper - // Spigot Start - if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { - Entity vehicle = entity.getVehicle(); -@@ -184,7 +185,7 @@ public abstract class BaseSpawner { - ((Mob) entity).spawnAnim(); - } - -- flag = true; -+ /*flag = true;*/ // Paper - moved up above cancellable event - } - } - } diff --git a/patches/server-remapped/0152-PlayerAttemptPickupItemEvent.patch b/patches/server/0141-PlayerAttemptPickupItemEvent.patch similarity index 88% rename from patches/server-remapped/0152-PlayerAttemptPickupItemEvent.patch rename to patches/server/0141-PlayerAttemptPickupItemEvent.patch index 1c5b10dcee..34d1b804a7 100644 --- a/patches/server-remapped/0152-PlayerAttemptPickupItemEvent.patch +++ b/patches/server/0141-PlayerAttemptPickupItemEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerAttemptPickupItemEvent diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index 72d1e83ac5e4ae3c943ca5ec1058f0d7ad2903cd..de69f7c3c0ee1e74682b0db91bdaae09175690e9 100644 +index d17af2ec8f72bf0cbe5928e7a83c06ba5ad4503d..54025e401eb02fceb47afb182f0ede620ca23a8d 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -35,6 +35,7 @@ import net.minecraft.stats.Stats; +@@ -37,6 +37,7 @@ import net.minecraft.stats.Stats; import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit end @@ -16,7 +16,7 @@ index 72d1e83ac5e4ae3c943ca5ec1058f0d7ad2903cd..de69f7c3c0ee1e74682b0db91bdaae09 public class ItemEntity extends Entity { -@@ -364,6 +365,22 @@ public class ItemEntity extends Entity { +@@ -381,6 +382,22 @@ public class ItemEntity extends Entity { int remaining = i - canHold; boolean flyAtPlayer = false; // Paper diff --git a/patches/server-remapped/0153-Add-UnknownCommandEvent.patch b/patches/server/0142-Add-UnknownCommandEvent.patch similarity index 87% rename from patches/server-remapped/0153-Add-UnknownCommandEvent.patch rename to patches/server/0142-Add-UnknownCommandEvent.patch index 9979b7ace2..59bbfebad4 100644 --- a/patches/server-remapped/0153-Add-UnknownCommandEvent.patch +++ b/patches/server/0142-Add-UnknownCommandEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add UnknownCommandEvent diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7b2ece40c09ba336a0c2a84321401619801c64c8..b9e39a4c0aea3de96d1774ae0d0d23ff82162c7e 100644 +index dcc1a3856560ab0eb4de45a358e189134adeac17..55444b51e416857a3854a0f1a41f24390f744119 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -790,7 +790,13 @@ public final class CraftServer implements Server { +@@ -792,7 +792,13 @@ public final class CraftServer implements Server { // Spigot start if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) { diff --git a/patches/server-remapped/0154-Basic-PlayerProfile-API.patch b/patches/server/0143-Basic-PlayerProfile-API.patch similarity index 89% rename from patches/server-remapped/0154-Basic-PlayerProfile-API.patch rename to patches/server/0143-Basic-PlayerProfile-API.patch index ce8cf66ee0..a7f1053f59 100644 --- a/patches/server-remapped/0154-Basic-PlayerProfile-API.patch +++ b/patches/server/0143-Basic-PlayerProfile-API.patch @@ -7,14 +7,14 @@ Establishes base extension of profile systems for future edits too diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java new file mode 100644 -index 0000000000000000000000000000000000000000..8f559897e408eee8617af0bb77fa4635e07ccdce +index 0000000000000000000000000000000000000000..ef6aab69daa7ab952408b573bff6c6996cbc349a --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java @@ -0,0 +1,303 @@ +package com.destroystokyo.paper.profile; + -+import PlayerProfile; -+import ProfileProperty; ++import com.destroystokyo.paper.profile.PlayerProfile; ++import com.destroystokyo.paper.profile.ProfileProperty; +import com.destroystokyo.paper.PaperConfig; +import com.google.common.base.Charsets; +import com.mojang.authlib.GameProfile; @@ -207,7 +207,7 @@ index 0000000000000000000000000000000000000000..8f559897e408eee8617af0bb77fa4635 + copyProfileProperties(result, this.profile, true); + } + if (this.profile.isComplete()) { -+ server.getProfileCache().saveProfile(this.profile); ++ server.getProfileCache().add(this.profile); + } + } + return profile.isComplete() && (!onlineMode || !textures || hasTextures()); @@ -430,19 +430,18 @@ index 0000000000000000000000000000000000000000..3cdd06d3af7ff94f1fe1a11b9a9275e1 + } +} diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index d29fe67b7d39e368a873368a6be16042429e9209..68c3f069f8f832ab3d146748348aded69b5ad823 100644 +index 80f8d6ce6dd717d4b37b78539c65b6ac814ec93d..966f0951832040c38fdd2caa58f7eae372aa0f59 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -1,6 +1,8 @@ +@@ -1,5 +1,7 @@ package net.minecraft.server; - import com.destroystokyo.paper.block.TargetBlockInfo; +import com.destroystokyo.paper.profile.CraftPlayerProfile; +import com.destroystokyo.paper.profile.PlayerProfile; import com.google.common.util.concurrent.ThreadFactoryBuilder; import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; import net.minecraft.core.BlockPos; -@@ -11,6 +13,7 @@ import net.minecraft.world.level.ChunkPos; +@@ -10,6 +12,7 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; import org.apache.commons.lang.exception.ExceptionUtils; @@ -450,7 +449,7 @@ index d29fe67b7d39e368a873368a6be16042429e9209..68c3f069f8f832ab3d146748348aded6 import org.bukkit.Location; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.CraftWorld; -@@ -345,6 +348,10 @@ public final class MCUtil { +@@ -344,6 +347,10 @@ public final class MCUtil { return run.get(); } @@ -462,10 +461,10 @@ index d29fe67b7d39e368a873368a6be16042429e9209..68c3f069f8f832ab3d146748348aded6 * Calculates distance between 2 entities * @param e1 diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 5d83a8d4c69144219219877c521c364d912d2452..2bfc54941ec34c75c2d59bda748c75730b9951f7 100644 +index c8385460701395cb5c65fba41335469ffb2d9b9a..fb0b3c5770f66cc3590f5ac4e690a33cb6179be3 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -124,7 +124,7 @@ public class Main { +@@ -130,7 +130,7 @@ public class Main { } File file = (File) optionset.valueOf("universe"); // CraftBukkit @@ -475,33 +474,24 @@ index 5d83a8d4c69144219219877c521c364d912d2452..2bfc54941ec34c75c2d59bda748c7573 GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); GameProfileCache usercache = new GameProfileCache(gameprofilerepository, new File(file, MinecraftServer.USERID_CACHE_FILE.getName())); diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index e8af352f813a5015d216fc590190ae8fdb03f77d..941b7e356c377fd8ad4e27409cd74c0046878396 100644 +index 3eb4bee81a8543cc06b9d5898f5f6c0e9dbbf554..8ea7d9a2070074a45d3276b8d2abac6285edbbdb 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java -@@ -45,7 +45,7 @@ public class GameProfileCache { - - private static final Logger LOGGER = LogManager.getLogger(); - private static boolean usesAuthentication; -- private final Map profilesByName = Maps.newConcurrentMap(); -+ private final Map profilesByName = Maps.newConcurrentMap();private final Map nameCache = profilesByName; // Paper - OBFHELPER // Paper - private final Map profilesByUUID = Maps.newConcurrentMap(); - private final GameProfileRepository profileRepository; - private final Gson gson = (new GsonBuilder()).create(); -@@ -110,6 +110,7 @@ public class GameProfileCache { +@@ -118,6 +118,7 @@ public class GameProfileCache { return com.destroystokyo.paper.PaperConfig.isProxyOnlineMode(); // Paper } -+ public void saveProfile(GameProfile gameprofile) { add(gameprofile); } // Paper - OBFHELPER - public synchronized void add(GameProfile gameprofile) { // Paper - synchronize ++ @Deprecated public void saveProfile(GameProfile gameprofile) { add(gameprofile); } // Paper - OBFHELPER + public synchronized void add(GameProfile profile) { // Paper - synchronize Calendar calendar = Calendar.getInstance(); -@@ -159,6 +160,13 @@ public class GameProfileCache { - return gameprofile; +@@ -190,6 +191,13 @@ public class GameProfileCache { + } } + // Paper start + @Nullable public GameProfile getProfileIfCached(String name) { -+ GameProfileCache.GameProfileInfo entry = this.nameCache.get(name.toLowerCase(Locale.ROOT)); ++ GameProfileCache.GameProfileInfo entry = this.profilesByName.get(name.toLowerCase(Locale.ROOT)); + return entry == null ? null : entry.getProfile(); + } + // Paper end @@ -509,20 +499,11 @@ index e8af352f813a5015d216fc590190ae8fdb03f77d..941b7e356c377fd8ad4e27409cd74c00 @Nullable public GameProfile get(UUID uuid) { GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByUUID.get(uuid); -@@ -341,7 +349,7 @@ public class GameProfileCache { - - static class GameProfileInfo { - -- private final GameProfile profile; -+ private final GameProfile profile;public GameProfile getProfile() { return profile; } // Paper - OBFHELPER - private final Date expirationDate; - private volatile long lastAccess; - diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b9e39a4c0aea3de96d1774ae0d0d23ff82162c7e..df68599520189e2699c8521d6c6ab7235612af33 100644 +index 55444b51e416857a3854a0f1a41f24390f744119..0be8b1727ce57ec0905315922e1d83104a936cd0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -223,6 +223,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; +@@ -226,6 +226,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; import net.md_5.bungee.api.chat.BaseComponent; // Spigot @@ -532,7 +513,7 @@ index b9e39a4c0aea3de96d1774ae0d0d23ff82162c7e..df68599520189e2699c8521d6c6ab723 public final class CraftServer implements Server { private final String serverName = "Paper"; // Paper private final String serverVersion; -@@ -2315,5 +2318,24 @@ public final class CraftServer implements Server { +@@ -2314,5 +2317,24 @@ public final class CraftServer implements Server { public boolean suggestPlayerNamesWhenNullTabCompletions() { return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions; } @@ -558,7 +539,7 @@ index b9e39a4c0aea3de96d1774ae0d0d23ff82162c7e..df68599520189e2699c8521d6c6ab723 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -index 313ddd6b64e395a8caab77b3da005e52006ab2d7..750661540f55d3c59119dcc909e706e571a2123b 100644 +index b19d50bbe6c944ff66230ac013178bd036a438c8..5e345224e698bd80133dc194385c033369a60a33 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java @@ -80,6 +80,13 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { diff --git a/patches/server-remapped/0155-Shoulder-Entities-Release-API.patch b/patches/server/0144-Shoulder-Entities-Release-API.patch similarity index 89% rename from patches/server-remapped/0155-Shoulder-Entities-Release-API.patch rename to patches/server/0144-Shoulder-Entities-Release-API.patch index e71eeed527..788c702193 100644 --- a/patches/server-remapped/0155-Shoulder-Entities-Release-API.patch +++ b/patches/server/0144-Shoulder-Entities-Release-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Shoulder Entities Release API diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index ae10c531ae69eaf6b78a342dcedb89c39fd8dbcc..3205bc2fb6c9031be68ff46dfca927e681163fa8 100644 +index 73277b04a45444edce02cce3e033741ebaf2ad0c..075bbc75d2e33be3a42c6c3ec279eeeba6408333 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -1877,20 +1877,44 @@ public abstract class Player extends LivingEntity { +@@ -1953,20 +1953,44 @@ public abstract class Player extends LivingEntity { } @@ -58,11 +58,11 @@ index ae10c531ae69eaf6b78a342dcedb89c39fd8dbcc..3205bc2fb6c9031be68ff46dfca927e6 @Override public abstract boolean isSpectator(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index b5c0f3d91cf451a972f0cf293db03a306073c493..c62d01719f21762aa10294815ab88e450e4dce3f 100644 +index d27a7ac64d1daf85319ab0069b9196f1958f6f46..6c404878e58f68c9ac86a1771c23e528f3817e32 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -494,6 +494,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { - getHandle().getCooldowns().addCooldown(CraftMagicNumbers.getItem(material), ticks); + this.getHandle().getCooldowns().addCooldown(CraftMagicNumbers.getItem(material), ticks); } + // Paper start @@ -93,4 +93,4 @@ index b5c0f3d91cf451a972f0cf293db03a306073c493..c62d01719f21762aa10294815ab88e45 + @Override public boolean discoverRecipe(NamespacedKey recipe) { - return discoverRecipes(Arrays.asList(recipe)) != 0; + return this.discoverRecipes(Arrays.asList(recipe)) != 0; diff --git a/patches/server-remapped/0156-Profile-Lookup-Events.patch b/patches/server/0145-Profile-Lookup-Events.patch similarity index 100% rename from patches/server-remapped/0156-Profile-Lookup-Events.patch rename to patches/server/0145-Profile-Lookup-Events.patch diff --git a/patches/server-remapped/0157-Block-player-logins-during-server-shutdown.patch b/patches/server/0146-Block-player-logins-during-server-shutdown.patch similarity index 87% rename from patches/server-remapped/0157-Block-player-logins-during-server-shutdown.patch rename to patches/server/0146-Block-player-logins-during-server-shutdown.patch index f43b561da9..588fe4a932 100644 --- a/patches/server-remapped/0157-Block-player-logins-during-server-shutdown.patch +++ b/patches/server/0146-Block-player-logins-during-server-shutdown.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Block player logins during server shutdown diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index e3c1460c580ea348ee6d436018244441a5a1206e..fca291c34c67d552590320c6e6e9c08e21d19fa8 100644 +index 3e57eb2e50f94085fd23b54a54d4cf7a0b7919c7..29555323bcc7d7faa3af6ed4507a1646714ab84a 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -66,6 +66,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -69,6 +69,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } public void tick() { diff --git a/patches/server-remapped/0158-Entity-fromMobSpawner.patch b/patches/server/0147-Entity-fromMobSpawner.patch similarity index 60% rename from patches/server-remapped/0158-Entity-fromMobSpawner.patch rename to patches/server/0147-Entity-fromMobSpawner.patch index 10fa81134b..389189b26f 100644 --- a/patches/server-remapped/0158-Entity-fromMobSpawner.patch +++ b/patches/server/0147-Entity-fromMobSpawner.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity#fromMobSpawner() diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a017fa55002d6674124befa3f6e81eb70c9ce8f7..7e70bae5bc54ad17980789fa965fd539a7f193ea 100644 +index 0204bde9802429aca5470c235cb10232e5c8f58a..bc15a3d8f3807caee357d55952b51326db51253f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -267,6 +267,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -301,6 +301,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; public long activatedTick = Integer.MIN_VALUE; @@ -16,43 +16,43 @@ index a017fa55002d6674124befa3f6e81eb70c9ce8f7..7e70bae5bc54ad17980789fa965fd539 protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -1665,6 +1666,10 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - tag.setUUID("Paper.OriginWorld", origin.getWorld().getUID()); - tag.put("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); +@@ -1840,6 +1841,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n + nbt.setUUID("Paper.OriginWorld", origin.getWorld().getUID()); + nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } + // Save entity's from mob spawner status + if (spawnedViaMobSpawner) { -+ tag.putBoolean("Paper.FromMobSpawner", true); ++ nbt.putBoolean("Paper.FromMobSpawner", true); + } // Paper end - return tag; + return nbt; } catch (Throwable throwable) { -@@ -1797,6 +1802,8 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -1976,6 +1981,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } origin = new org.bukkit.Location(originWorld, originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); } + -+ spawnedViaMobSpawner = tag.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status ++ spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status // Paper end } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index ed631d5bfba5d2543e8eed017a7c484ad3ddb453..7541155048744a9af2017ec039cf99a246addb0b 100644 +index 037dafb59e54047d1d54474c44897d35b8f46c98..59996bb75dc050f51cadb31ad57c25eb46485f52 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -160,6 +160,7 @@ public abstract class BaseSpawner { - } - // Spigot End + if (this.nextSpawnData.getTag().size() == 1 && this.nextSpawnData.getTag().contains("id", 8)) { + ((Mob) entity).finalizeSpawn(world, world.getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.SPAWNER, (SpawnGroupData) null, (CompoundTag) null); } -+ entity.spawnedViaMobSpawner = true; // Paper ++ entity.spawnedViaMobSpawner = true; // Paper // Spigot Start - if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { - Entity vehicle = entity.getVehicle(); + if (entityinsentient.level.spigotConfig.nerfSpawnerMobs) { + entityinsentient.aware = false; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index b028946de7c8f52091635fe154c816453f1ddc93..ecb5f5ca547930f91602d539e541964cd9f10287 100644 +index 271b4e3354c3885e38ae0c547edba48bf06f1e19..1fd891b53c54153c28d636b2679b4a083510ba3c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1100,5 +1100,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1133,5 +1133,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { Location origin = getHandle().origin; return origin == null ? null : origin.clone(); } diff --git a/patches/server-remapped/0159-Improve-the-Saddle-API-for-Horses.patch b/patches/server/0148-Improve-the-Saddle-API-for-Horses.patch similarity index 94% rename from patches/server-remapped/0159-Improve-the-Saddle-API-for-Horses.patch rename to patches/server/0148-Improve-the-Saddle-API-for-Horses.patch index 85d5e4f330..4f3f3977fc 100644 --- a/patches/server-remapped/0159-Improve-the-Saddle-API-for-Horses.patch +++ b/patches/server/0148-Improve-the-Saddle-API-for-Horses.patch @@ -7,7 +7,7 @@ Not all horses with Saddles have armor. This lets us break up the horses with sa and access their saddle state separately from an interface shared with Armor. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java -index 116553ea587ab5ff3bc8a1530f51cd6efb7ae8ca..6136b3322a340d506ce744bcd15f71a158e46ad1 100644 +index 6f473dbf949552afd288382b36223ea036eaa857..27a1ca43792644fc239af81dea5510f25d3328e9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java @@ -5,6 +5,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes; @@ -22,7 +22,7 @@ index 116553ea587ab5ff3bc8a1530f51cd6efb7ae8ca..6136b3322a340d506ce744bcd15f71a1 @Override public AbstractHorseInventory getInventory() { -- return new CraftInventoryAbstractHorse(getHandle().inventory); +- return new CraftInventoryAbstractHorse(this.getHandle().inventory); + return new CraftSaddledInventory(getHandle().inventory); } } diff --git a/patches/server-remapped/0160-Implement-ensureServerConversions-API.patch b/patches/server/0149-Implement-ensureServerConversions-API.patch similarity index 87% rename from patches/server-remapped/0160-Implement-ensureServerConversions-API.patch rename to patches/server/0149-Implement-ensureServerConversions-API.patch index bc3d68abd4..72f70ceb8c 100644 --- a/patches/server-remapped/0160-Implement-ensureServerConversions-API.patch +++ b/patches/server/0149-Implement-ensureServerConversions-API.patch @@ -7,10 +7,10 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr to ensure it meets latest minecraft expectations. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index 32fa5ca0df07466e40817341d85d359b282f3078..41c8bbf93039add43695a52d2bfc0c2cef88463d 100644 +index 921d838afc5b7ae47a9ee81b7ae4450543a32d98..0bf6c27fdcc2a4342c68441670244cabf40f8e7e 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -@@ -346,5 +346,11 @@ public final class CraftItemFactory implements ItemFactory { +@@ -349,5 +349,11 @@ public final class CraftItemFactory implements ItemFactory { public net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component displayName(@org.jetbrains.annotations.NotNull ItemStack itemStack) { return io.papermc.paper.adventure.PaperAdventure.asAdventure(CraftItemStack.asNMSCopy(itemStack).displayName()); } diff --git a/patches/server-remapped/0161-Implement-getI18NDisplayName.patch b/patches/server/0150-Implement-getI18NDisplayName.patch similarity index 59% rename from patches/server-remapped/0161-Implement-getI18NDisplayName.patch rename to patches/server/0150-Implement-getI18NDisplayName.patch index c27fb916c9..a8882d517d 100644 --- a/patches/server-remapped/0161-Implement-getI18NDisplayName.patch +++ b/patches/server/0150-Implement-getI18NDisplayName.patch @@ -8,36 +8,22 @@ Currently the server only supports the English language. To override this, You must replace the language file embedded in the server jar. diff --git a/src/main/java/net/minecraft/locale/Language.java b/src/main/java/net/minecraft/locale/Language.java -index 8a0d2e510aee160ec3a817fd72c23bc9dfeb6287..756b78a7dc3d3e76dc0a37375b304db0b6ecf684 100644 +index f06452538f45e2430611aad54d060e040b32bb58..67f5448d0a03c1e018f71bdb76610a85867cc0b8 100644 --- a/src/main/java/net/minecraft/locale/Language.java +++ b/src/main/java/net/minecraft/locale/Language.java -@@ -30,7 +30,7 @@ public abstract class Language { - - private static Language loadDefault() { - Builder builder = ImmutableMap.builder(); -- BiConsumer biconsumer = builder::put; -+ BiConsumer biconsumer = builder::put; // Paper - decompile fix - - try { - InputStream inputstream = Language.class.getResourceAsStream("/assets/minecraft/lang/en_us.json"); -@@ -87,10 +87,12 @@ public abstract class Language { - +@@ -107,6 +107,7 @@ public abstract class Language { + instance = language; } -+ public static Language getInstance() { return getInstance(); } // Paper - OBFHELPER - public static Language getInstance() { - return Language.instance; - } - -+ public String translateKey(String key) { return getOrDefault(key); } // Paper - OBFHELPER ++ @Deprecated public String translateKey(String key) { return getOrDefault(key); } // Paper - OBFHELPER public abstract String getOrDefault(String key); public abstract boolean has(String key); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index 41c8bbf93039add43695a52d2bfc0c2cef88463d..746755f76ae177b2eeccf66f8cd95e6ffd5acad9 100644 +index 0bf6c27fdcc2a4342c68441670244cabf40f8e7e..6ec39de514ceed7e5ffe9a8dc94c2ffd2902cd98 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -@@ -352,5 +352,18 @@ public final class CraftItemFactory implements ItemFactory { +@@ -355,5 +355,18 @@ public final class CraftItemFactory implements ItemFactory { public ItemStack ensureServerConversions(ItemStack item) { return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item)); } @@ -52,7 +38,7 @@ index 41c8bbf93039add43695a52d2bfc0c2cef88463d..746755f76ae177b2eeccf66f8cd95e6f + nms = CraftItemStack.asNMSCopy(item); + } + -+ return nms != null ? net.minecraft.locale.Language.getInstance().translateKey(nms.getItem().getDescriptionId()) : null; ++ return nms != null ? net.minecraft.locale.Language.getInstance().getOrDefault(nms.getItem().getDescriptionId()) : null; + } // Paper end } diff --git a/patches/server-remapped/0162-ProfileWhitelistVerifyEvent.patch b/patches/server/0151-ProfileWhitelistVerifyEvent.patch similarity index 85% rename from patches/server-remapped/0162-ProfileWhitelistVerifyEvent.patch rename to patches/server/0151-ProfileWhitelistVerifyEvent.patch index 5051a6a195..83ccd291bb 100644 --- a/patches/server-remapped/0162-ProfileWhitelistVerifyEvent.patch +++ b/patches/server/0151-ProfileWhitelistVerifyEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 7d6256f65d369fcbcfe1fffe7ac264788a38540b..ae60b233c4d56a4964b388f96e9cc66410774e8d 100644 +index bf6c3ac7ae37067f345568fb6656cf6b4d864be2..429e6c7f9a5e5355e26deeae1e89ffea7439cd96 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -611,9 +611,9 @@ public abstract class PlayerList { +@@ -607,9 +607,9 @@ public abstract class PlayerList { // return chatmessage; if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Spigot // Paper - Adventure @@ -18,10 +18,10 @@ index 7d6256f65d369fcbcfe1fffe7ac264788a38540b..ae60b233c4d56a4964b388f96e9cc664 + } else if (!this.isWhitelisted(gameprofile, event)) { // Paper + //chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); // Paper + //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted - } else if (getIpBans().isBanned(socketaddress) && !getIpBans().get(socketaddress).hasExpired()) { + } else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) { IpBanListEntry ipbanentry = this.ipBans.get(socketaddress); -@@ -1005,9 +1005,25 @@ public abstract class PlayerList { +@@ -989,9 +989,25 @@ public abstract class PlayerList { this.server.getCommands().sendCommands(player); } @@ -34,7 +34,7 @@ index 7d6256f65d369fcbcfe1fffe7ac264788a38540b..ae60b233c4d56a4964b388f96e9cc664 + boolean isOp = this.ops.contains(gameprofile); + boolean isWhitelisted = !this.doWhiteList || isOp || this.whitelist.contains(gameprofile); + final com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent event; -+ event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(MCUtil.toBukkit(gameprofile), this.doWhiteList, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage); ++ event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(net.minecraft.server.MCUtil.toBukkit(gameprofile), this.doWhiteList, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage); + event.callEvent(); + if (!event.isWhitelisted()) { + if (loginEvent != null) { diff --git a/patches/server-remapped/0163-Fix-this-stupid-bullshit.patch b/patches/server/0152-Fix-this-stupid-bullshit.patch similarity index 88% rename from patches/server-remapped/0163-Fix-this-stupid-bullshit.patch rename to patches/server/0152-Fix-this-stupid-bullshit.patch index 8eacc81f8c..a666a1f647 100644 --- a/patches/server-remapped/0163-Fix-this-stupid-bullshit.patch +++ b/patches/server/0152-Fix-this-stupid-bullshit.patch @@ -9,12 +9,12 @@ modified in order to prevent merge conflicts when Spigot changes/disables the wa and to provide some level of hint without being disruptive. diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 60d9980ccca6f1ac55b70f7684b917ddceac380a..808a7688ed81bdfef623ee0a151ff8f94df2a3d7 100644 +index b4bcd34123968b3930bb330f7c2abd9b5518fa31..f68d44721c91c20a7e4abffe26dabff8b5d2c3ce 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -224,10 +224,12 @@ public class Main { +@@ -228,10 +228,12 @@ public class Main { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -28); + deadline.add(Calendar.DAY_OF_YEAR, -3); if (buildDate.before(deadline.getTime())) { - System.err.println("*** Error, this build is outdated ***"); + // Paper start - This is some stupid bullshit diff --git a/patches/server-remapped/0168-LivingEntity-setKiller.patch b/patches/server/0153-LivingEntity-setKiller.patch similarity index 82% rename from patches/server-remapped/0168-LivingEntity-setKiller.patch rename to patches/server/0153-LivingEntity-setKiller.patch index fdb6acae74..e6db1422e6 100644 --- a/patches/server-remapped/0168-LivingEntity-setKiller.patch +++ b/patches/server/0153-LivingEntity-setKiller.patch @@ -5,10 +5,10 @@ Subject: [PATCH] LivingEntity#setKiller diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index c1786fcabeaee5732e9197db04268c5c4e164339..d6b4fabd232958ae1fd5405c7129551951cd7765 100644 +index f0357f9d7b6a39bbdf6486a9d35d890942cc5e4c..89913edf98d65f08f379d0d201f9963c23573478 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -177,7 +177,7 @@ public abstract class LivingEntity extends Entity { +@@ -207,7 +207,7 @@ public abstract class LivingEntity extends Entity { public float flyingSpeed; @Nullable public net.minecraft.world.entity.player.Player lastHurtByPlayer; @@ -18,7 +18,7 @@ index c1786fcabeaee5732e9197db04268c5c4e164339..d6b4fabd232958ae1fd5405c71295519 protected int noActionTime; protected float oRun; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index d8cd88d62f9abfc7960c187dd74239f61267ca57..006f4c71bbcda61b55815e7ceab91731ab062da0 100644 +index ea94dc9a3b8bd3da5f8ccbeb216384723db668aa..4e9565def5a28a7391f8f541d066c2981d0bbc92 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -8,6 +8,7 @@ import java.util.Iterator; @@ -30,7 +30,7 @@ index d8cd88d62f9abfc7960c187dd74239f61267ca57..006f4c71bbcda61b55815e7ceab91731 import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffect; @@ -332,6 +333,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - return getHandle().lastHurtByPlayer == null ? null : (Player) getHandle().lastHurtByPlayer.getBukkitEntity(); + return this.getHandle().lastHurtByPlayer == null ? null : (Player) this.getHandle().lastHurtByPlayer.getBukkitEntity(); } + // Paper start @@ -45,4 +45,4 @@ index d8cd88d62f9abfc7960c187dd74239f61267ca57..006f4c71bbcda61b55815e7ceab91731 + @Override public boolean addPotionEffect(PotionEffect effect) { - return addPotionEffect(effect, false); + return this.addPotionEffect(effect, false); diff --git a/patches/server-remapped/0164-Ocelot-despawns-should-honor-nametags-and-leash.patch b/patches/server/0154-Ocelot-despawns-should-honor-nametags-and-leash.patch similarity index 85% rename from patches/server-remapped/0164-Ocelot-despawns-should-honor-nametags-and-leash.patch rename to patches/server/0154-Ocelot-despawns-should-honor-nametags-and-leash.patch index 07571c80e4..d194c656d3 100644 --- a/patches/server-remapped/0164-Ocelot-despawns-should-honor-nametags-and-leash.patch +++ b/patches/server/0154-Ocelot-despawns-should-honor-nametags-and-leash.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ocelot despawns should honor nametags and leash diff --git a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java -index 1b820ca48845cbe4a668cc31582c2ddf6d50c96a..142025cfb75b24dc6df8160f4922086404efa6a7 100644 +index 38ddb72b53fcf0d6a9331d23b11572e9f85e70e3..8104ac0f77e8e94f294b82f7badefccd72419223 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java +++ b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java -@@ -128,7 +128,7 @@ public class Ocelot extends Animal { +@@ -133,7 +133,7 @@ public class Ocelot extends Animal { @Override public boolean removeWhenFarAway(double distanceSquared) { diff --git a/patches/server/0155-Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/patches/server/0155-Reset-spawner-timer-when-spawner-event-is-cancelled.patch new file mode 100644 index 0000000000..c0bec5fce6 --- /dev/null +++ b/patches/server/0155-Reset-spawner-timer-when-spawner-event-is-cancelled.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Mon, 31 Jul 2017 01:45:19 -0500 +Subject: [PATCH] Reset spawner timer when spawner event is cancelled + + +diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java +index 59996bb75dc050f51cadb31ad57c25eb46485f52..a3d829eb2e43f51db0e1282ff32039bca574a752 100644 +--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java ++++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +@@ -167,6 +167,7 @@ public abstract class BaseSpawner { + } + // Spigot End + } ++ flag = true; // Paper + // Spigot Start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { + Entity vehicle = entity.getVehicle(); +@@ -190,7 +191,7 @@ public abstract class BaseSpawner { + ((Mob) entity).spawnAnim(); + } + +- flag = true; ++ //flag = true; // Paper - moved up above cancellable event + } + } + diff --git a/patches/server-remapped/0167-Allow-specifying-a-custom-authentication-servers-dow.patch b/patches/server/0156-Allow-specifying-a-custom-authentication-servers-dow.patch similarity index 94% rename from patches/server-remapped/0167-Allow-specifying-a-custom-authentication-servers-dow.patch rename to patches/server/0156-Allow-specifying-a-custom-authentication-servers-dow.patch index 766b536512..c3a07caf8d 100644 --- a/patches/server-remapped/0167-Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/patches/server/0156-Allow-specifying-a-custom-authentication-servers-dow.patch @@ -27,10 +27,10 @@ index 48319aaf1c525c6fb7bdee5c2f570a0d056d4eae..52954fc3bf932cfc9d5ce63e3d3cace3 + } } diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index fca291c34c67d552590320c6e6e9c08e21d19fa8..4b91699ddfa2ee298af5ba25447a85751facf4a4 100644 +index 29555323bcc7d7faa3af6ed4507a1646714ab84a..700ab378f43b3841c82b7aadc1c3818dc0621a58 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -275,6 +275,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -297,6 +297,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener ServerLoginPacketListenerImpl.this.gameProfile = ServerLoginPacketListenerImpl.this.createFakeProfile(gameprofile); ServerLoginPacketListenerImpl.this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT; } else {