mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-29 12:37:37 +01:00
Merge pull request #419 from BentoBoxWorld/prevent-teleport-when-falling
Added PREVENT_TELEPORT_WHEN_FALLING flag (WORLD_SETTING)
This commit is contained in:
commit
2e4daaa1d9
@ -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,12 @@ 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) {
|
||||
// We're sending the "hint" to the player to tell them they cannot teleport while falling.
|
||||
user.sendMessage(Flags.PREVENT_TELEPORT_WHEN_FALLING.getHintReference());
|
||||
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()));
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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]"
|
||||
|
Loading…
Reference in New Issue
Block a user