From 82fbd97fe626b6e6b266a2921b751c2045585ed6 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 9 Jan 2025 21:04:48 -0800 Subject: [PATCH] EMC - Configurable disable give dropping Modified version of a patch by Aikar from EMC. Adds a config option in purpur.yml to disable the /give command from dropping items on the floor when a player's inventory is full. --- ...C-Configurable-disable-give-dropping.patch | 37 ------------------- .../server/commands/GiveCommand.java.patch | 10 +++++ .../org/purpurmc/purpur/PurpurConfig.java | 5 +++ 3 files changed, 15 insertions(+), 37 deletions(-) delete mode 100644 patches/server/0105-EMC-Configurable-disable-give-dropping.patch create mode 100644 purpur-server/minecraft-patches/sources/net/minecraft/server/commands/GiveCommand.java.patch diff --git a/patches/server/0105-EMC-Configurable-disable-give-dropping.patch b/patches/server/0105-EMC-Configurable-disable-give-dropping.patch deleted file mode 100644 index 9a0f6b78e..000000000 --- a/patches/server/0105-EMC-Configurable-disable-give-dropping.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 14 Jan 2016 00:49:14 -0500 -Subject: [PATCH] EMC - Configurable disable give dropping - -Modified version of a patch by Aikar from EMC. Adds a config option in -purpur.yml to disable the /give command from dropping items on the -floor when a player's inventory is full. - -diff --git a/net/minecraft/server/commands/GiveCommand.java b/net/minecraft/server/commands/GiveCommand.java -index 0d9de4c61c7b26a6ff37c12fde629161fd0c3d5a..2f7897744f4aea718170698881773e9031a58a51 100644 ---- a/net/minecraft/server/commands/GiveCommand.java -+++ b/net/minecraft/server/commands/GiveCommand.java -@@ -60,6 +60,7 @@ public class GiveCommand { - boolean flag = entityplayer.getInventory().add(itemstack1); - ItemEntity entityitem; - -+ if (org.purpurmc.purpur.PurpurConfig.disableGiveCommandDrops) continue; // Purpur - add config option for toggling give command dropping - if (flag && itemstack1.isEmpty()) { - entityitem = entityplayer.drop(itemstack, false, false, false); // CraftBukkit - SPIGOT-2942: Add boolean to call event - if (entityitem != null) { -diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index c61105bfb22531b728cb4f4af24c68625db5a99f..5feee7c130e71731051e610aeb0e8c3341bddb2e 100644 ---- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java -+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -@@ -212,6 +212,11 @@ public class PurpurConfig { - useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive); - } - -+ public static boolean disableGiveCommandDrops = false; -+ private static void disableGiveCommandDrops() { -+ disableGiveCommandDrops = getBoolean("settings.disable-give-dropping", disableGiveCommandDrops); -+ } -+ - public static int barrelRows = 3; - public static boolean enderChestSixRows = false; - public static boolean enderChestPermissionRows = false; diff --git a/purpur-server/minecraft-patches/sources/net/minecraft/server/commands/GiveCommand.java.patch b/purpur-server/minecraft-patches/sources/net/minecraft/server/commands/GiveCommand.java.patch new file mode 100644 index 000000000..5cedf347f --- /dev/null +++ b/purpur-server/minecraft-patches/sources/net/minecraft/server/commands/GiveCommand.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/server/commands/GiveCommand.java ++++ b/net/minecraft/server/commands/GiveCommand.java +@@ -66,6 +_,7 @@ + i1 -= min; + ItemStack itemStack1 = item.createItemStack(min, false); + boolean flag = serverPlayer.getInventory().add(itemStack1); ++ if (org.purpurmc.purpur.PurpurConfig.disableGiveCommandDrops) continue; // Purpur - add config option for toggling give command dropping + if (flag && itemStack1.isEmpty()) { + ItemEntity itemEntity = serverPlayer.drop(itemStack, false, false, false); // CraftBukkit - SPIGOT-2942: Add boolean to call event + if (itemEntity != null) { diff --git a/purpur-server/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/purpur-server/src/main/java/org/purpurmc/purpur/PurpurConfig.java index e9cd9308c..fde00550d 100644 --- a/purpur-server/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/purpur-server/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -195,6 +195,11 @@ public class PurpurConfig { useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive); } + public static boolean disableGiveCommandDrops = false; + private static void disableGiveCommandDrops() { + disableGiveCommandDrops = getBoolean("settings.disable-give-dropping", disableGiveCommandDrops); + } + public static int barrelRows = 3; public static boolean enderChestSixRows = false; public static boolean enderChestPermissionRows = false;