mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-04-25 16:09:44 +00:00
Add force-disable-teleport-safety option (default false). This option is useful for preventing "teleport-glitching" in Factions servers.
This commit is contained in:
parent
ea4c966003
commit
f995676fad
5 changed files with 29 additions and 3 deletions
|
@ -92,6 +92,8 @@ public interface ISettings extends IConf {
|
|||
|
||||
boolean isTeleportSafetyEnabled();
|
||||
|
||||
boolean isForceDisableTeleportSafety();
|
||||
|
||||
double getTeleportCooldown();
|
||||
|
||||
double getTeleportDelay();
|
||||
|
|
|
@ -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<String>(config.getStringList("no-god-in-worlds"));
|
||||
enabledSigns = _getEnabledSigns();
|
||||
teleportSafety = _isTeleportSafetyEnabled();
|
||||
forceDisableTeleportSafety = _isForceDisableTeleportSafety();
|
||||
teleportInvulnerabilityTime = _getTeleportInvulnerability();
|
||||
teleportInvulnerability = _isTeleportInvulnerability();
|
||||
disableItemPickupWhileAfk = _getDisableItemPickupWhileAfk();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -316,6 +316,6 @@ public class LocationUtil {
|
|||
}
|
||||
}
|
||||
|
||||
return y < 0 ? true : false;
|
||||
return y < 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue