From 2d7353c0765a4cf4bf96f2656431096fa79eb9fa Mon Sep 17 00:00:00 2001 From: ZeroEpoch1969 <13510767+ZeroEpoch1969@users.noreply.github.com> Date: Sat, 8 Feb 2020 21:52:43 -0700 Subject: [PATCH] block beehives --- .../totalfreedommod/blocking/BlockBlocker.java | 11 +++++++++++ .../totalfreedommod/command/Command_toggle.java | 8 +++++++- .../totalfreedommod/config/ConfigEntry.java | 1 + src/main/resources/config.yml | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java index 8fefaab1..83a4d1eb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java @@ -147,6 +147,17 @@ public class BlockBlocker extends FreedomService } break; } + case BEEHIVE: + case BEE_NEST: + { + if (!ConfigEntry.ALLOW_BEEHIVES.getBoolean()) + { + player.sendMessage(ChatColor.GRAY + "Bee hives are disabled."); + player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1)); + event.setCancelled(true); + } + break; + } case PLAYER_HEAD: case PLAYER_WALL_HEAD: { 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 c1015827..c01eb597 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java @@ -47,6 +47,7 @@ public class Command_toggle extends FreedomCommand msg("- jukeboxes"); msg("- spawners"); msg("- 4chan"); + msg("- beehives"); return false; } @@ -219,6 +220,11 @@ public class Command_toggle extends FreedomCommand toggle("4chan mode is", ConfigEntry.FOURCHAN_ENABLED); return true; } + else if (args[0].equalsIgnoreCase("beehives")) + { + toggle("Beehives are", ConfigEntry.ALLOW_BEEHIVES); + return true; + } else { return false; @@ -238,7 +244,7 @@ public class Command_toggle extends FreedomCommand return Arrays.asList( "waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk", "firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs", - "bells", "armorstands", "clearonjoin", "tpronjoin", "structureblocks", "jigsaws", "grindstones", "jukeboxes", "spawners", "4chan"); + "bells", "armorstands", "clearonjoin", "tpronjoin", "structureblocks", "jigsaws", "grindstones", "jukeboxes", "spawners", "4chan", "beehives"); } return Collections.emptyList(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java index 4101ef62..b0bf9312 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java @@ -32,6 +32,7 @@ public enum ConfigEntry ALLOW_GRINDSTONES(Boolean.class, "allow.grindstones"), ALLOW_JUKEBOXES(Boolean.class, "allow.jukeboxes"), ALLOW_SPAWNERS(Boolean.class, "allow.spawners"), + ALLOW_BEEHIVES(Boolean.class, "allow.beehives"), // BLOCKED_CHATCODES(String.class, "blocked_chatcodes"), // diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index a93997c4..ee723658 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -151,6 +151,7 @@ allow: grindstones: false jukeboxes: false spawners: false + beehives: false # Blocked commands: #