Skip to content

Commit

Permalink
Add the modify flower pots rule
Browse files Browse the repository at this point in the history
  • Loading branch information
haykam821 authored and Patbox committed Nov 10, 2024
1 parent fceb366 commit 9dfab5e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 9dfab5e

Please sign in to comment.