From 9dfab5e1a7e2a128b857629e64fa1f15c1ebef2e Mon Sep 17 00:00:00 2001 From: haykam821 <24855774+haykam821@users.noreply.github.com> Date: Sun, 16 Jun 2024 19:04:14 -0400 Subject: [PATCH] Add the modify flower pots rule --- README.md | 1 + src/main/java/xyz/nucleoid/leukocyte/rule/ProtectionRule.java | 1 + .../leukocyte/rule/enforcer/LeukocyteRuleEnforcer.java | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 0881409..46dd9ef 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Leukocyte provides various rules that can be applied within authorities. These r - `pickup_items` controls whether items can be picked up by players or other entities - `unstable_tnt` controls tnt automatically igniting when placed - `ignite_tnt` controls whether tnt can be ignited + - `modify_flower_pots` controls whether plants can be placed in or removed from flower pots - `firework_explode` controls whether fireworks can explode instead of only fizzling out - `dispenser_activate` controls whether dispensers and droppers can be activated - `spawn_withers` controls whether withers can be summoned diff --git a/src/main/java/xyz/nucleoid/leukocyte/rule/ProtectionRule.java b/src/main/java/xyz/nucleoid/leukocyte/rule/ProtectionRule.java index 0737197..f9ea1a7 100644 --- a/src/main/java/xyz/nucleoid/leukocyte/rule/ProtectionRule.java +++ b/src/main/java/xyz/nucleoid/leukocyte/rule/ProtectionRule.java @@ -40,6 +40,7 @@ public final class ProtectionRule { public static final ProtectionRule UNSTABLE_TNT = register("unstable_tnt"); public static final ProtectionRule IGNITE_TNT = register("ignite_tnt"); + public static final ProtectionRule MODIFY_FLOWER_POTS = register("modify_flower_pots"); public static final ProtectionRule FIREWORK_EXPLODE = register("firework_explode"); public static final ProtectionRule DISPENSER_ACTIVATE = register("dispenser_activate"); public static final ProtectionRule SPAWN_WITHER = register("spawn_wither"); diff --git a/src/main/java/xyz/nucleoid/leukocyte/rule/enforcer/LeukocyteRuleEnforcer.java b/src/main/java/xyz/nucleoid/leukocyte/rule/enforcer/LeukocyteRuleEnforcer.java index e0ec5be..af05ff7 100644 --- a/src/main/java/xyz/nucleoid/leukocyte/rule/enforcer/LeukocyteRuleEnforcer.java +++ b/src/main/java/xyz/nucleoid/leukocyte/rule/enforcer/LeukocyteRuleEnforcer.java @@ -23,6 +23,7 @@ import xyz.nucleoid.stimuli.event.block.BlockUseEvent; import xyz.nucleoid.stimuli.event.block.CoralDeathEvent; import xyz.nucleoid.stimuli.event.block.DispenserActivateEvent; +import xyz.nucleoid.stimuli.event.block.FlowerPotModifyEvent; import xyz.nucleoid.stimuli.event.block.FluidRandomTickEvent; import xyz.nucleoid.stimuli.event.entity.EntityActivateDeathProtectionEvent; import xyz.nucleoid.stimuli.event.entity.EntityShearEvent; @@ -189,6 +190,9 @@ private void applyWorldRules(ProtectionRuleMap rules, EventRegistrar events) { this.forRule(events, rules.test(ProtectionRule.IGNITE_TNT)) .applySimple(TntIgniteEvent.EVENT, rule -> (world, pos, igniter) -> rule); + this.forRule(events, rules.test(ProtectionRule.MODIFY_FLOWER_POTS)) + .applySimple(FlowerPotModifyEvent.EVENT, rule -> (player, hand, hitResult) -> rule); + this.forRule(events, rules.test(ProtectionRule.FIREWORK_EXPLODE)) .applySimple(FireworkExplodeEvent.EVENT, rule -> firework -> rule);