Add break-spawner flag (#1263)

* Implements #1130

* Add proper styling to spawner-flag

Co-Authored-By: Florian CUNY <poslovitch@bentobox.world>

* Enforce yaml style

Co-Authored-By: Florian CUNY <poslovitch@bentobox.world>

Co-authored-by: Florian CUNY <poslovitch@bentobox.world>
This commit is contained in:
NotMyFault 2020-04-04 21:32:59 +02:00 committed by GitHub
parent f3220e1fda
commit 74007a7a9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View File

@ -76,9 +76,11 @@ public class BreakBlocksListener extends FlagListener {
switch (e.getClickedBlock().getType()) {
case CAKE:
case SPAWNER:
checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.BREAK_BLOCKS);
break;
case SPAWNER:
checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.BREAK_SPAWNERS);
break;
case DRAGON_EGG:
checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.DRAGON_EGG);
break;

View File

@ -80,6 +80,12 @@ public final class Flags {
* @see BreakBlocksListener
*/
public static final Flag BREAK_BLOCKS = new Flag.Builder("BREAK_BLOCKS", Material.STONE_PICKAXE).listener(new BreakBlocksListener()).mode(Flag.Mode.BASIC).build();
/**
* Prevents players from breaking spawners on one's island.
* @see BreakBlocksListener
* @since 1.13.0
*/
public static final Flag BREAK_SPAWNERS = new Flag.Builder("BREAK_SPAWNERS", Material.SPAWNER).mode(Flag.Mode.EXPERT).build();
/**
* Prevents players from placing blocks on one's island.
* @see PlaceBlocksListener

View File

@ -695,6 +695,12 @@ protection:
description: "Toggle breaking"
name: "Break blocks"
hint: "Block breaking disabled"
BREAK_SPAWNERS:
description: |-
Toggle spawners breaking.
Override the Break Blocks flag.
name: "Break spawners"
hint: "Spawner breaking disabled"
BREEDING:
description: "Toggle breeding"
name: "Breed animals"
@ -1390,4 +1396,3 @@ successfully-loaded: |
&6 | |_) | __/ | | | || (_) | |_) | (_) > < &b v&e [version]
&6 |____/ \___|_| |_|\__\___/|____/ \___/_/\_\ &8 Loaded in &e [time]&8 ms.