Purpur/patches/server/0119-EMC-Configurable-disable-give-dropping.patch
BillyGalbreath 417a025211
Updated Upstream (Paper & Pufferfish)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@e4f5e1c Bump netty

Pufferfish Changes:
pufferfish-gg/Pufferfish@a8543a4 #33 Fix anti-xray related crash bug
pufferfish-gg/Pufferfish@aefcb1a Updated Upstream (Paper)
2022-06-12 22:59:25 -05:00

38 lines
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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/src/main/java/net/minecraft/server/commands/GiveCommand.java b/src/main/java/net/minecraft/server/commands/GiveCommand.java
index 06e3a868e922f1b7a586d0ca28f64a67ae463b68..32beb045f990d4da6112da4fea295333cb69e2ea 100644
--- a/src/main/java/net/minecraft/server/commands/GiveCommand.java
+++ b/src/main/java/net/minecraft/server/commands/GiveCommand.java
@@ -58,6 +58,7 @@ public class GiveCommand {
boolean flag = entityplayer.getInventory().add(itemstack);
ItemEntity entityitem;
+ if (org.purpurmc.purpur.PurpurConfig.disableGiveCommandDrops) continue; // Purpur - add config option for toggling give command dropping
if (flag && itemstack.isEmpty()) {
itemstack.setCount(1);
entityitem = entityplayer.drop(itemstack, false, false, false); // SPIGOT-2942: Add boolean to call event
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index e80a13cd7178e056e5fdf770de7f5c03342dc52d..c55504d376f331b01d53aad6a9492ce2f8a4bbd3 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -202,6 +202,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;