Java Code Examples for com.sk89q.worldedit.world.World#getName()

The following examples show how to use com.sk89q.worldedit.world.World#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FaweForge.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getWorldName(World world) {
    if (world instanceof WorldWrapper) {
        return getWorldName(((WorldWrapper) world).getParent());
    }
    else if (world instanceof EditSession) {
        return getWorldName(((EditSession) world).getWorld());
    } else if (world.getClass().getName().equals("com.sk89q.worldedit.bukkit.BukkitWorld")) {
        try {
            Class<?> classBukkitWorld = world.getClass();
            Method methodGetWorld = classBukkitWorld.getDeclaredMethod("getWorld");
            methodGetWorld.setAccessible(true);
            Object craftWorld = methodGetWorld.invoke(world);
            Class<? extends Object> classCraftWorld = craftWorld.getClass();
            Method methodGetHandle = classCraftWorld.getDeclaredMethod("getHandle");
            methodGetHandle.setAccessible(true);
            Object nmsWorld = methodGetHandle.invoke(craftWorld);
            return getWorldName((net.minecraft.world.World) nmsWorld);
        } catch (Throwable e) {
            e.printStackTrace();
            return world.getName();
        }
    }else if (world instanceof LocalWorldAdapter){
        return world.getName();
    }
    return getWorldName(((ForgeWorld) world).getWorld());
}
 
Example 2
Source File: FaweSponge.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getWorldName(World world) {
    return world.getName();
}
 
Example 3
Source File: FaweBukkit.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getWorldName(World world) {
    return world.getName();
}
 
Example 4
Source File: FaweSponge.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getWorldName(World world) {
    return world.getName();
}
 
Example 5
Source File: FaweNukkit.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getWorldName(World world) {
    return world.getName();
}