Splited PORTAL flag to NETHER_PORTAL and END_PORTAL

#388
Remove the "silent" parameter when doing the check for the End portal: the Notifier will do the job to not spam the player.
This commit is contained in:
Florian CUNY 2018-12-16 10:42:04 +01:00
parent 3e18669abc
commit 2d533ed8ad
3 changed files with 10 additions and 7 deletions

View File

@ -11,17 +11,15 @@ import world.bentobox.bentobox.lists.Flags;
/**
* Handles portal protection
* @author tastybento
*
*/
public class PortalListener extends FlagListener {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerPortal(PlayerPortalEvent e) {
if (e.getCause().equals(TeleportCause.NETHER_PORTAL)) {
checkIsland(e, e.getFrom(), Flags.PORTAL);
checkIsland(e, e.getFrom(), Flags.NETHER_PORTAL);
} else if (e.getCause().equals(TeleportCause.END_PORTAL)) {
// Silent check because it's spammy
checkIsland(e, e.getFrom(), Flags.PORTAL, true);
checkIsland(e, e.getFrom(), Flags.END_PORTAL);
}
}
}

View File

@ -101,7 +101,8 @@ public class Flags {
public static final Flag LEASH = new FlagBuilder().id("LEASH").icon(Material.LEAD).listener(new LeashListener()).build();
// Portal use protection
public static final Flag PORTAL = new FlagBuilder().id("PORTAL").icon(Material.OBSIDIAN).listener(new PortalListener()).build();
public static final Flag NETHER_PORTAL = new FlagBuilder().id("NETHER_PORTAL").icon(Material.OBSIDIAN).listener(new PortalListener()).build();
public static final Flag END_PORTAL = new FlagBuilder().id("END_PORTAL").icon(Material.END_PORTAL_FRAME).listener(new PortalListener()).build();
// Shearing
public static final Flag SHEARING = new FlagBuilder().id("SHEARING").icon(Material.SHEARS).listener(new ShearingListener()).build();

View File

@ -650,9 +650,13 @@ protection:
description: "Toggle placing"
name: "Place blocks"
hint: "Not allowed to place blocks"
PORTAL:
NETHER_PORTAL:
description: "Toggle use"
name: "Portal"
name: "Nether Portal"
hint: "Portal use is disallowed"
END_PORTAL:
description: "Toggle use"
name: "End Portal"
hint: "Portal use is disallowed"
PRESSURE_PLATE:
description: "Toggle usage"