Posted January 5, 201312 yr As the title says. This is the only thing I've found: world.getWorldInfo().getWorldName() , which only returns the worlds name. Thanks in advance. No 5 row long documentation = account on the help forums
January 5, 201312 yr Haha I had the exact same problem just this morning I figured it out though, so don't worry. Explanation via words: First, you're going to need to get the server instance from ModLoader ( ModLoader.getMinecraftServerInstance() ). Then, you're going to need to get the folder name of the server instance ( .getFolderName() ). Store that for later. Next, get the ISaveFormat from the server instance ( .getActiveAnvilConverter() ). After that, obtain the SaveHandler from the ISaveFormat and give it the folder name we stored earlier as well as a boolean as to whether or not to mkdirs for the player folder (I just use false) ( .getSaveLoader(folderName, false) ). Then, just get the saveDirectory from the SaveHandler ( .getSaveDirectory() ). Explanation via code: MinecraftServer mcServerInstance = ModLoader.getMinecraftServerInstance(); String folderName = mcServerInstance.getFolderName(); ISaveFormat saveFormat = mcServerInstance.getActiveAnvilConverter(); SaveHandler saveHandler = (SaveHandler)saveFormat.getSaveLoader(folderName, false); // You will have to typecast here File saveDir = saveHandler.getSaveDirectory(); Hope this helps! Ask any questions if you have them and I'll try to answer them.
January 6, 201312 yr Author Haha I had the exact same problem just this morning I figured it out though, so don't worry. Explanation via words: First, you're going to need to get the server instance from ModLoader ( ModLoader.getMinecraftServerInstance() ). Then, you're going to need to get the folder name of the server instance ( .getFolderName() ). Store that for later. Next, get the ISaveFormat from the server instance ( .getActiveAnvilConverter() ). After that, obtain the SaveHandler from the ISaveFormat and give it the folder name we stored earlier as well as a boolean as to whether or not to mkdirs for the player folder (I just use false) ( .getSaveLoader(folderName, false) ). Then, just get the saveDirectory from the SaveHandler ( .getSaveDirectory() ). Explanation via code: MinecraftServer mcServerInstance = ModLoader.getMinecraftServerInstance(); String folderName = mcServerInstance.getFolderName(); ISaveFormat saveFormat = mcServerInstance.getActiveAnvilConverter(); SaveHandler saveHandler = (SaveHandler)saveFormat.getSaveLoader(folderName, false); // You will have to typecast here File saveDir = saveHandler.getSaveDirectory(); Hope this helps! Ask any questions if you have them and I'll try to answer them. Thanks a lot for your answer. However I still got an error, and after printing the file path I saw it contained a folder called MpServer. So I check when that occurs and return null, works so I'm happy. No 5 row long documentation = account on the help forums
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.