Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the modify flower pots rule #69

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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 @@ -39,6 +39,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 @@ -22,6 +22,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.EntityShearEvent;
import xyz.nucleoid.stimuli.event.entity.EntitySpawnEvent;
Expand Down Expand Up @@ -184,6 +185,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