mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-18 22:49:45 +00:00
Fix some reported bugs regarding teleportation. (#3433)
Fixes #3420 Fixes #3430
This commit is contained in:
parent
60f54ee37d
commit
b7f38517ef
5 changed files with 15 additions and 3 deletions
|
@ -121,6 +121,8 @@ public interface ISettings extends IConf {
|
||||||
|
|
||||||
boolean isForceDisableTeleportSafety();
|
boolean isForceDisableTeleportSafety();
|
||||||
|
|
||||||
|
boolean isAlwaysTeleportSafety();
|
||||||
|
|
||||||
boolean isTeleportPassengerDismount();
|
boolean isTeleportPassengerDismount();
|
||||||
|
|
||||||
double getTeleportCooldown();
|
double getTeleportCooldown();
|
||||||
|
|
|
@ -157,6 +157,11 @@ public class Settings implements net.ess3.api.ISettings {
|
||||||
return forceDisableTeleportSafety;
|
return forceDisableTeleportSafety;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAlwaysTeleportSafety() {
|
||||||
|
return config.getBoolean("force-safe-teleport-location", false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTeleportPassengerDismount() {
|
public boolean isTeleportPassengerDismount() {
|
||||||
return config.getBoolean("teleport-passenger-dismount", true);
|
return config.getBoolean("teleport-passenger-dismount", true);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.utils.StringUtil;
|
import com.earth2me.essentials.utils.StringUtil;
|
||||||
|
@ -41,7 +42,7 @@ public class Commandhome extends EssentialsCommand {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if ("bed".equalsIgnoreCase(homeName) && user.isAuthorized("essentials.home.bed")) {
|
if ("bed".equalsIgnoreCase(homeName) && user.isAuthorized("essentials.home.bed")) {
|
||||||
if (!player.getBase().isOnline()) {
|
if (!player.getBase().isOnline() || player.getBase() instanceof OfflinePlayer) {
|
||||||
throw new Exception(tl("bedOffline"));
|
throw new Exception(tl("bedOffline"));
|
||||||
}
|
}
|
||||||
PaperLib.getBedSpawnLocationAsync(player.getBase(), true).thenAccept(location -> {
|
PaperLib.getBedSpawnLocationAsync(player.getBase(), true).thenAccept(location -> {
|
||||||
|
|
|
@ -153,8 +153,8 @@ public class LocationUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Location getSafeDestination(final IEssentials ess, final IUser user, final Location loc) throws Exception {
|
public static Location getSafeDestination(final IEssentials ess, final IUser user, final Location loc) throws Exception {
|
||||||
if (user.getBase().isOnline() && (user.getBase().getGameMode() == GameMode.CREATIVE || user.getBase().getGameMode() == GameMode.SPECTATOR || user.isGodModeEnabled()) || user.getBase().getAllowFlight()) {
|
if (user.getBase().isOnline() && (ess == null || !ess.getSettings().isAlwaysTeleportSafety()) && (user.getBase().getGameMode() == GameMode.CREATIVE || user.getBase().getGameMode() == GameMode.SPECTATOR || user.isGodModeEnabled())) {
|
||||||
if (shouldFly(loc)) {
|
if (shouldFly(loc) && user.getBase().getAllowFlight()) {
|
||||||
user.getBase().setFlying(true);
|
user.getBase().setFlying(true);
|
||||||
}
|
}
|
||||||
// ess can be null if old deprecated method is calling it.
|
// ess can be null if old deprecated method is calling it.
|
||||||
|
|
|
@ -78,6 +78,10 @@ teleport-safety: true
|
||||||
# teleport-safety and this option need to be set to true to force teleportation to dangerous locations.
|
# teleport-safety and this option need to be set to true to force teleportation to dangerous locations.
|
||||||
force-disable-teleport-safety: false
|
force-disable-teleport-safety: false
|
||||||
|
|
||||||
|
# If a player is teleporting to an unsafe location in creative, adventure, or god mode; they will not be teleported to a
|
||||||
|
# safe location. If you'd like players to be teleported to a safe location all of the time, set this option to true.
|
||||||
|
force-safe-teleport-location: false
|
||||||
|
|
||||||
# If a player has any passengers, the teleport will fail. Should their passengers be dismounted before they are teleported?
|
# If a player has any passengers, the teleport will fail. Should their passengers be dismounted before they are teleported?
|
||||||
# If this is set to true, Essentials will dismount the player's passengers before teleporting.
|
# If this is set to true, Essentials will dismount the player's passengers before teleporting.
|
||||||
# If this is set to false, attempted teleports will be canceled with a warning.
|
# If this is set to false, attempted teleports will be canceled with a warning.
|
||||||
|
|
Loading…
Reference in a new issue