mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-14 05:01:28 +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 isAlwaysTeleportSafety();
|
||||
|
||||
boolean isTeleportPassengerDismount();
|
||||
|
||||
double getTeleportCooldown();
|
||||
|
|
|
@ -157,6 +157,11 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
return forceDisableTeleportSafety;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlwaysTeleportSafety() {
|
||||
return config.getBoolean("force-safe-teleport-location", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTeleportPassengerDismount() {
|
||||
return config.getBoolean("teleport-passenger-dismount", true);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.OfflinePlayer;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
|
@ -41,7 +42,7 @@ public class Commandhome extends EssentialsCommand {
|
|||
}
|
||||
try {
|
||||
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"));
|
||||
}
|
||||
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 {
|
||||
if (user.getBase().isOnline() && (user.getBase().getGameMode() == GameMode.CREATIVE || user.getBase().getGameMode() == GameMode.SPECTATOR || user.isGodModeEnabled()) || user.getBase().getAllowFlight()) {
|
||||
if (shouldFly(loc)) {
|
||||
if (user.getBase().isOnline() && (ess == null || !ess.getSettings().isAlwaysTeleportSafety()) && (user.getBase().getGameMode() == GameMode.CREATIVE || user.getBase().getGameMode() == GameMode.SPECTATOR || user.isGodModeEnabled())) {
|
||||
if (shouldFly(loc) && user.getBase().getAllowFlight()) {
|
||||
user.getBase().setFlying(true);
|
||||
}
|
||||
// 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.
|
||||
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 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.
|
||||
|
|
Loading…
Reference in a new issue