From d25d1713f8da306aa4060e46d33845a86288a794 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 10 Jun 2023 15:49:10 -0700 Subject: [PATCH] Adds protection for sign editing for 1.20 Fixes #2135 --- .../flags/protection/BlockInteractionListener.java | 5 +++++ .../java/world/bentobox/bentobox/lists/Flags.java | 11 ++++++++--- src/main/resources/locales/en-US.yml | 6 ++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java index 2dbd511a3..801968894 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java @@ -155,6 +155,11 @@ public class BlockInteractionListener extends FlagListener return; } + if (Tag.SIGNS.isTagged(type)) { + this.checkIsland(e, player, loc, Flags.SIGN_EDITING); + return; + } + if (Tag.FENCE_GATES.isTagged(type)) { this.checkIsland(e, player, loc, Flags.GATE); diff --git a/src/main/java/world/bentobox/bentobox/lists/Flags.java b/src/main/java/world/bentobox/bentobox/lists/Flags.java index 4f74ca46e..3fd2ac9f7 100644 --- a/src/main/java/world/bentobox/bentobox/lists/Flags.java +++ b/src/main/java/world/bentobox/bentobox/lists/Flags.java @@ -653,16 +653,21 @@ public final class Flags { * Controls who gets to harvest any crop related contents. e.g. Wheat, Sugar Cane, melon blocks, not stems, pumpkin blocks, etc. * @since 1.23.0 */ - public static final Flag HARVEST = new Flag.Builder("HARVEST", Material.PUMPKIN).type(Type.PROTECTION).build(); + public static final Flag HARVEST = new Flag.Builder("HARVEST", Material.PUMPKIN).mode(Flag.Mode.BASIC).type(Type.PROTECTION).build(); /** * Crop Planting * Controls who gets to plant crops on tilled soil. * @since 1.23.0 */ - public static final Flag CROP_PLANTING = new Flag.Builder("CROP_PLANTING", Material.PUMPKIN_SEEDS).type(Type.PROTECTION).build(); + public static final Flag CROP_PLANTING = new Flag.Builder("CROP_PLANTING", Material.PUMPKIN_SEEDS).mode(Flag.Mode.BASIC).type(Type.PROTECTION).build(); + + /** + * Sign edit protection + * @since 1.24.0 + */ + public static final Flag SIGN_EDITING = new Flag.Builder("SIGN_EDITING", Material.DARK_OAK_SIGN).mode(Flag.Mode.BASIC).type(Type.PROTECTION).build(); - /** * Provides a list of all the Flag instances contained in this class using reflection. * Deprecated Flags are ignored. diff --git a/src/main/resources/locales/en-US.yml b/src/main/resources/locales/en-US.yml index 7fead2e3b..dbddac83a 100644 --- a/src/main/resources/locales/en-US.yml +++ b/src/main/resources/locales/en-US.yml @@ -1325,6 +1325,12 @@ protection: &a activation. name: "Sculk Shrieker" hint: "sculk shrieker activation is disabled" + SIGN_EDITING: + description: |- + &a Allows text editing + &a of signs + name: "Sign Editing" + hint: "sign editing is disabled" TNT_DAMAGE: description: |- &a Allow TNT and TNT minecarts