diff --git a/forge1710/src/main/java/com/boydti/fawe/forge/FaweForge.java b/forge1710/src/main/java/com/boydti/fawe/forge/FaweForge.java index 4d9d22f3..d4188cce 100644 --- a/forge1710/src/main/java/com/boydti/fawe/forge/FaweForge.java +++ b/forge1710/src/main/java/com/boydti/fawe/forge/FaweForge.java @@ -17,6 +17,7 @@ import com.sk89q.worldedit.world.World; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.ModMetadata; import java.io.File; +import java.lang.reflect.Method; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collection; @@ -132,6 +133,21 @@ public class FaweForge implements IFawe { } 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 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(); + } } return getWorldName(((ForgeWorld) world).getWorld()); }