mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Fix WorldEditPlugin assuming that worlds are an instance of BukkitWorld.
Fixes WORLDEDIT-3168.
This commit is contained in:
parent
5dd7b83940
commit
e93c9c9736
@ -35,6 +35,27 @@ final class BukkitAdapter {
|
||||
private BukkitAdapter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert any WorldEdit world into an equivalent wrapped Bukkit world.
|
||||
*
|
||||
* <p>If a matching world cannot be found, a {@link RuntimeException}
|
||||
* will be thrown.</p>
|
||||
*
|
||||
* @param world the world
|
||||
* @return a wrapped Bukkit world
|
||||
*/
|
||||
public static BukkitWorld asBukkitWorld(World world) {
|
||||
if (world instanceof BukkitWorld) {
|
||||
return (BukkitWorld) world;
|
||||
} else {
|
||||
BukkitWorld bukkitWorld = WorldEditPlugin.getInstance().getInternalPlatform().matchWorld(world);
|
||||
if (bukkitWorld == null) {
|
||||
throw new RuntimeException("World '" + world.getName() + "' has no matching version in Bukkit");
|
||||
}
|
||||
return bukkitWorld;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a WorldEdit world from a Bukkit world.
|
||||
*
|
||||
|
@ -110,9 +110,9 @@ public class BukkitServerInterface extends ServerInterface implements MultiUserP
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public com.sk89q.worldedit.world.World matchWorld(com.sk89q.worldedit.world.World world) {
|
||||
public BukkitWorld matchWorld(com.sk89q.worldedit.world.World world) {
|
||||
if (world instanceof BukkitWorld) {
|
||||
return world;
|
||||
return (BukkitWorld) world;
|
||||
} else {
|
||||
World bukkitWorld = server.getWorld(world.getName());
|
||||
return bukkitWorld != null ? new BukkitWorld(bukkitWorld) : null;
|
||||
|
@ -412,7 +412,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
||||
|
||||
try {
|
||||
Region region = selector.getRegion();
|
||||
World world = ((BukkitWorld) session.getSelectionWorld()).getWorld();
|
||||
World world = BukkitAdapter.asBukkitWorld(session.getSelectionWorld()).getWorld();
|
||||
|
||||
if (region instanceof CuboidRegion) {
|
||||
return new CuboidSelection(world, selector, (CuboidRegion) region);
|
||||
|
Loading…
Reference in New Issue
Block a user