mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2025-01-07 19:38:56 +01:00
Prevent TP if world is not loaded. Fixes #191
This commit is contained in:
parent
c3b6e3b6fb
commit
051632eba6
@ -992,6 +992,12 @@ public static Consumer<CommandSender> createTeleportConsumer(CommandSender src,
|
||||
}
|
||||
|
||||
final Player player = (Player) src;
|
||||
// check if world is loaded
|
||||
if (Bukkit.getWorld(location.getWorld().getUID()) == null) {
|
||||
TextAdapter.sendComponent(player, MessageCache.getInstance().TELEPORT_NO_SAFE_LOCATION);
|
||||
return;
|
||||
}
|
||||
|
||||
final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getPlayerData(player.getWorld(), player.getUniqueId());
|
||||
final int teleportDelay = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Integer.class), player, Options.PLAYER_TELEPORT_DELAY, claim);
|
||||
if (isClaimSpawn) {
|
||||
|
@ -225,6 +225,10 @@ public void sendInteractEntityDenyMessage(GDClaim claim, Player player, ItemStac
|
||||
}
|
||||
|
||||
public boolean isSafeLocation(Location location) {
|
||||
// check if world is loaded
|
||||
if (Bukkit.getWorld(location.getWorld().getUID()) == null) {
|
||||
return false;
|
||||
}
|
||||
final Block currentBlock = location.getBlock();
|
||||
final Block aboveBlock = currentBlock.getRelative(BlockFace.UP);
|
||||
final Block belowBlock =currentBlock.getRelative(BlockFace.DOWN);
|
||||
|
Loading…
Reference in New Issue
Block a user