Skip to content

Commit

Permalink
Few fixes to COARSE_DIRT_TILLING flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Poslovitch committed Nov 11, 2018
1 parent 72738f4 commit 23af6e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
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)) {
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK) || e.getItem() == null) {
return;
}

Expand All @@ -26,7 +28,9 @@ public void onTillingCoarseDirt(PlayerInteractEvent e) {
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);
e.setCancelled(true);
User user = User.getInstance(e.getPlayer());
user.notify("protection.protected", TextVariables.DESCRIPTION, user.getTranslation(Flags.COARSE_DIRT_TILLING.getHintReference()));
}
break;
default:
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,9 @@ protection:
name: "Clean Super Flat"
COARSE_DIRT_TILLING:
description: |-
&aPrevent the players from
&atilling the coarse dirt
&ato obtain dirt
&aToggle tilling the
&acoarse dirt to
&aobtain dirt
name: "Coarse dirt tilling"
hint: "No coarse dirt tilling"
COLLECT_LAVA:
Expand Down

0 comments on commit 23af6e7

Please sign in to comment.