Purpur/patches/server/0119-EMC-Configurable-disable-give-dropping.patch

38 lines
2.1 KiB
Diff
Raw Normal View History

2021-06-20 10:35:04 +08:00
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
2022-06-08 23:50:34 +08:00
index 06e3a868e922f1b7a586d0ca28f64a67ae463b68..32beb045f990d4da6112da4fea295333cb69e2ea 100644
2021-06-20 10:35:04 +08:00
--- a/src/main/java/net/minecraft/server/commands/GiveCommand.java
+++ b/src/main/java/net/minecraft/server/commands/GiveCommand.java
2022-06-08 23:50:34 +08:00
@@ -58,6 +58,7 @@ public class GiveCommand {
boolean flag = entityplayer.getInventory().add(itemstack);
ItemEntity entityitem;
2021-11-30 05:37:07 +08:00
+ 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
2021-11-29 21:30:53 +08:00
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
2022-06-08 23:50:34 +08:00
index e80a13cd7178e056e5fdf770de7f5c03342dc52d..c55504d376f331b01d53aad6a9492ce2f8a4bbd3 100644
2021-11-29 21:30:53 +08:00
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
2022-06-08 23:50:34 +08:00
@@ -202,6 +202,11 @@ public class PurpurConfig {
2021-06-20 10:35:04 +08:00
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;
2021-06-20 10:35:04 +08:00
public static boolean enderChestSixRows = false;
public static boolean enderChestPermissionRows = false;