mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 05:35:44 +01:00
Added COARSE_DIRT_TILLING World Setting flag
This commit is contained in:
parent
f8d1626ba5
commit
6df262a14b
@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package world.bentobox.bentobox.listeners.flags;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
@ -0,0 +1,37 @@
|
||||
package world.bentobox.bentobox.listeners.flags;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import world.bentobox.bentobox.api.flags.FlagListener;
|
||||
import world.bentobox.bentobox.lists.Flags;
|
||||
|
||||
public class CoarseDirtTillingListener extends FlagListener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onTillingCoarseDirt(PlayerInteractEvent e) {
|
||||
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.getClickedBlock().getType().equals(Material.COARSE_DIRT)) {
|
||||
switch (e.getItem().getType()) {
|
||||
case WOODEN_HOE:
|
||||
case STONE_HOE:
|
||||
case IRON_HOE:
|
||||
case GOLDEN_HOE:
|
||||
case DIAMOND_HOE:
|
||||
if (e.getClickedBlock().getType().equals(Material.COARSE_DIRT)
|
||||
&& getIWM().inWorld(e.getClickedBlock().getWorld())
|
||||
&& !Flags.COARSE_DIRT_TILLING.isSetForWorld(e.getClickedBlock().getWorld())) {
|
||||
noGo(e, Flags.COARSE_DIRT_TILLING);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@ import world.bentobox.bentobox.listeners.flags.BreedingListener;
|
||||
import world.bentobox.bentobox.listeners.flags.BucketListener;
|
||||
import world.bentobox.bentobox.listeners.flags.ChestDamageListener;
|
||||
import world.bentobox.bentobox.listeners.flags.CleanSuperFlatListener;
|
||||
import world.bentobox.bentobox.listeners.flags.CoarseDirtTillingListener;
|
||||
import world.bentobox.bentobox.listeners.flags.CreeperListener;
|
||||
import world.bentobox.bentobox.listeners.flags.EggListener;
|
||||
import world.bentobox.bentobox.listeners.flags.EnderChestListener;
|
||||
@ -219,6 +220,8 @@ public class Flags {
|
||||
public static final Flag COMMAND_RANKS = new FlagBuilder().id("COMMAND_RANKS").icon(Material.PLAYER_HEAD).type(Type.WORLD_SETTING)
|
||||
.onClick(new CommandRankClickListener()).subPanel(true).build();
|
||||
|
||||
public static final Flag COARSE_DIRT_TILLING = new FlagBuilder().id("COARSE_DIRT_TILLING").icon(Material.COARSE_DIRT).type(Type.WORLD_SETTING).allowedByDefault(true).listener(new CoarseDirtTillingListener()).build();
|
||||
|
||||
/**
|
||||
* @return List of all the flags in this class
|
||||
*/
|
||||
|
@ -440,6 +440,13 @@ protection:
|
||||
&asuper-flat chunks in
|
||||
&aisland worlds
|
||||
name: "Clean Super Flat"
|
||||
COARSE_DIRT_TILLING:
|
||||
description: |-
|
||||
&aPrevent the players from
|
||||
&atilling the coarse dirt
|
||||
&ato obtain dirt
|
||||
name: "Coarse dirt tilling"
|
||||
hint: "No coarse dirt tilling"
|
||||
COLLECT_LAVA:
|
||||
description: |-
|
||||
&aToggle collecting lava
|
||||
|
Loading…
Reference in New Issue
Block a user