From ee594e7c6336df9e8bf26a1c828f0e3d1ab0c677 Mon Sep 17 00:00:00 2001 From: Allink Date: Sun, 23 Jul 2023 00:04:46 +0100 Subject: [PATCH] Add configuration value for player item drops --- .../totalfreedommod/blocking/EventBlocker.java | 2 +- .../totalfreedommod/command/Command_toggle.java | 12 +++++++++--- .../totalfreedommod/config/ConfigEntry.java | 1 + src/main/resources/config.yml | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java index fb3713cd..7b85d13d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java @@ -161,7 +161,7 @@ public class EventBlocker extends FreedomService @EventHandler(priority = EventPriority.NORMAL) public void onPlayerDropItem(PlayerDropItemEvent event) { - if (!plugin.al.isAdmin(event.getPlayer())) + if (!plugin.al.isAdmin(event.getPlayer()) && !ConfigEntry.ALLOW_ITEM_DROPS.getBoolean()) { event.setCancelled(true); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java index 712ff7ff..8cd16733 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java @@ -19,9 +19,9 @@ public class Command_toggle extends FreedomCommand private final List toggles = Arrays.asList( "waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk", "firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke [range] [count]", - "explosives [radius]", "unsafeenchs", "bells", "armorstands", "structureblocks", "jigsaws", "grindstones", - "jukeboxes", "spawners", "4chan", "beehives", "respawnanchors", "autotp", "autoclear", "minecarts", "mp44", - "landmines", "tossmob", "gravity"); + "explosives [radius]", "unsafeenchs", "bells", "armorstands", "structureblocks", "jigsaws", "item_drops", + "grindstones", "jukeboxes", "spawners", "4chan", "beehives", "respawnanchors", "autotp", "autoclear", "minecarts", + "mp44", "landmines", "tossmob", "gravity"); @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) @@ -205,6 +205,12 @@ public class Command_toggle extends FreedomCommand break; } + case "item_drops": + { + toggle("Item drops are", ConfigEntry.ALLOW_ITEM_DROPS); + break; + } + case "grindstones": { toggle("Grindstones are", ConfigEntry.ALLOW_GRINDSTONES); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java index 598c3d1f..66970325 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java @@ -35,6 +35,7 @@ public enum ConfigEntry AUTO_TP(Boolean.class, "allow.auto_tp"), AUTO_CLEAR(Boolean.class, "allow.auto_clear"), ALLOW_GRAVITY(Boolean.class, "allow.gravity"), + ALLOW_ITEM_DROPS(Boolean.class, "allow.item_drops"), // BLOCKED_CHATCODES(String.class, "blocked_chatcodes"), // diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index d0f9ff4d..ce93f972 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -234,6 +234,7 @@ allow: auto_tp: false auto_clear: false gravity: false + item_drops: false blocked_commands: #