Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Add configuration value for player item drops
Browse files Browse the repository at this point in the history
  • Loading branch information
Allink committed Jul 22, 2023
1 parent 41cf62c commit ee594e7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public void onEntityDamage(EntityDamageEvent event)
@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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public class Command_toggle extends FreedomCommand
private final List<String> 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)
Expand Down Expand Up @@ -205,6 +205,12 @@ public boolean run(CommandSender sender, Player playerSender, Command cmd, Strin
break;
}

case "item_drops":
{
toggle("Item drops are", ConfigEntry.ALLOW_ITEM_DROPS);
break;
}

case "grindstones":
{
toggle("Grindstones are", ConfigEntry.ALLOW_GRINDSTONES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
//
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ allow:
auto_tp: false
auto_clear: false
gravity: false
item_drops: false

blocked_commands:
#
Expand Down

0 comments on commit ee594e7

Please sign in to comment.