diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index d939eca54..c4111450a 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -92,6 +92,8 @@ public interface ISettings extends IConf { boolean isTeleportSafetyEnabled(); + boolean isForceDisableTeleportSafety(); + double getTeleportCooldown(); double getTeleportDelay(); diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 08a26f549..6dd9a892b 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -125,6 +125,17 @@ public class Settings implements net.ess3.api.ISettings { return teleportSafety; } + private boolean forceDisableTeleportSafety; + + private boolean _isForceDisableTeleportSafety() { + return config.getBoolean("force-disable-teleport-safety"); + } + + @Override + public boolean isForceDisableTeleportSafety() { + return forceDisableTeleportSafety; + } + @Override public double getTeleportDelay() { return config.getDouble("teleport-delay", 0); @@ -471,6 +482,7 @@ public class Settings implements net.ess3.api.ISettings { noGodWorlds = new HashSet(config.getStringList("no-god-in-worlds")); enabledSigns = _getEnabledSigns(); teleportSafety = _isTeleportSafetyEnabled(); + forceDisableTeleportSafety = _isForceDisableTeleportSafety(); teleportInvulnerabilityTime = _getTeleportInvulnerability(); teleportInvulnerability = _isTeleportInvulnerability(); disableItemPickupWhileAfk = _getDisableItemPickupWhileAfk(); diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index fc0820ab5..cb7261e2f 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -95,7 +95,11 @@ public class Teleport implements net.ess3.api.ITeleport { if (teleportee.getBase().isInsideVehicle()) { teleportee.getBase().leaveVehicle(); } - teleportee.getBase().teleport(LocationUtil.getSafeDestination(teleportee, loc), cause); + if (ess.getSettings().isForceDisableTeleportSafety()) { + teleportee.getBase().teleport(loc, cause); + } else { + teleportee.getBase().teleport(LocationUtil.getSafeDestination(teleportee, loc), cause); + } } else { throw new Exception(tl("unsafeTeleportDestination", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } @@ -103,7 +107,11 @@ public class Teleport implements net.ess3.api.ITeleport { if (teleportee.getBase().isInsideVehicle()) { teleportee.getBase().leaveVehicle(); } - teleportee.getBase().teleport(LocationUtil.getRoundedDestination(loc), cause); + if (ess.getSettings().isForceDisableTeleportSafety()) { + teleportee.getBase().teleport(loc, cause); + } else { + teleportee.getBase().teleport(LocationUtil.getRoundedDestination(loc), cause); + } } } diff --git a/Essentials/src/com/earth2me/essentials/utils/LocationUtil.java b/Essentials/src/com/earth2me/essentials/utils/LocationUtil.java index c578c6cf9..889fbd36f 100644 --- a/Essentials/src/com/earth2me/essentials/utils/LocationUtil.java +++ b/Essentials/src/com/earth2me/essentials/utils/LocationUtil.java @@ -316,6 +316,6 @@ public class LocationUtil { } } - return y < 0 ? true : false; + return y < 0; } } diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 025327ecb..057dcf19b 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -46,6 +46,10 @@ change-displayname: true # If this is set to false, attempted teleports to unsafe locations will be cancelled with a warning. teleport-safety: true +# This forcefully disables teleport safety checks without a warning if attempting to teleport to unsafe locations. +# teleport-safety and this option need to be set to true to force teleportation to dangerous locations. +force-disable-teleport-safety: false + # The delay, in seconds, required between /home, /tp, etc. teleport-cooldown: 0