mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-26 20:45:43 +01:00
Fix issues with sometimes-loaded worlds in location flags.
This commit is contained in:
parent
0f989fc1b4
commit
ce35798f67
@ -1089,7 +1089,7 @@ public void teleport(CommandContext args, Actor sender) throws CommandException
|
||||
// Lookup the existing region
|
||||
World world = checkWorld(args, player, 'w');
|
||||
RegionManager regionManager = checkRegionManager(world);
|
||||
ProtectedRegion existing = checkExistingRegion(regionManager, args.getString(0), false);
|
||||
ProtectedRegion existing = checkExistingRegion(regionManager, args.getString(0), true);
|
||||
|
||||
// Check permissions
|
||||
if (!getPermissionModel(player).mayTeleportTo(existing)) {
|
||||
|
@ -26,6 +26,7 @@
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@ -150,6 +151,7 @@ default Iterable<LocalPlayer> matchPlayers(LocalPlayer player) {
|
||||
* @param worldName The name
|
||||
* @return The world
|
||||
*/
|
||||
@Nullable
|
||||
World getWorldByName(String worldName);
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,12 @@ public Extent getExtent() {
|
||||
}
|
||||
// try loading the world again now
|
||||
// if it fails it will throw an error later (presumably when trying to teleport someone there)
|
||||
return Optional.ofNullable(findWorld(getWorldName())).orElse(NullWorld.getInstance());
|
||||
return Optional.ofNullable(findWorld(getWorldName())).orElse(new NullWorld() {
|
||||
@Override
|
||||
public String getName() {
|
||||
return worldName;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public String getWorldName() {
|
||||
|
@ -218,7 +218,11 @@ public Actor matchPlayerOrConsole(Actor sender, String filter) throws CommandExc
|
||||
|
||||
@Override
|
||||
public World getWorldByName(String worldName) {
|
||||
return BukkitAdapter.adapt(Bukkit.getServer().getWorld(worldName));
|
||||
final org.bukkit.World bukkitW = Bukkit.getServer().getWorld(worldName);
|
||||
if (bukkitW == null) {
|
||||
return null;
|
||||
}
|
||||
return BukkitAdapter.adapt(bukkitW);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user