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.
This commit is contained in:
Aikar
2025-01-09 21:04:48 -08:00
committed by granny
parent 16336009b7
commit 82fbd97fe6
3 changed files with 15 additions and 37 deletions

View File

@@ -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) {

View File

@@ -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;