Added PREVENT_TELEPORT_WHEN_FALLING flag (WORLD_SETTING)

Closes #403
This commit is contained in:
Florian CUNY 2018-12-27 11:47:11 +01:00
parent daa2992ba4
commit f662efc43e
3 changed files with 15 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import org.apache.commons.lang.math.NumberUtils;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.lists.Flags;
/**
* @author tastybento
@ -31,6 +32,11 @@ public class IslandGoCommand extends CompositeCommand {
user.sendMessage("general.errors.no-island");
return false;
}
if ((getIWM().inWorld(user.getWorld()) && !Flags.PREVENT_TELEPORT_WHEN_FALLING.isSetForWorld(user.getWorld()))
&& user.getPlayer().getFallDistance() > 0) {
user.sendMessage("protection.flags.PREVENT_TELEPORT_WHEN_FALLING.hint");
return true;
}
if (!args.isEmpty() && NumberUtils.isDigits(args.get(0))) {
int homeValue = Integer.parseInt(args.get(0));
int maxHomes = user.getPermissionValue(getPermissionPrefix() + "island.maxhomes", getIWM().getMaxHomes(getWorld()));

View File

@ -232,6 +232,8 @@ public final class Flags {
public static final Flag COARSE_DIRT_TILLING = new Flag.Builder("COARSE_DIRT_TILLING", Material.COARSE_DIRT).type(Type.WORLD_SETTING).defaultSetting(true).listener(new CoarseDirtTillingListener()).build();
public static final Flag PREVENT_TELEPORT_WHEN_FALLING = new Flag.Builder("PREVENT_TELEPORT_WHEN_FALLING", Material.FEATHER).type(Type.WORLD_SETTING).build();
/**
* @return List of all the flags in this class
*/

View File

@ -728,6 +728,13 @@ protection:
name: "Experience pickup"
description: "Toggle experience orb pickup"
hint: "cannot pickup experience orb"
PREVENT_TELEPORT_WHEN_FALLING:
name: "Prevent teleport when falling"
description: |-
&aPrevent players from teleporting
&aback to their island using commands
&aif they are falling.
hint: "&cYou cannot teleport back to your island while you are falling."
locked: "&cThis island is locked!"
protected: "&cIsland protected: [description]"
spawn-protected: "&cSpawn protected: [description]"