Major Improvements to DungeonHelper, Minor Bug Fixes and Tweaks #25

Merged
SenseiKiwi merged 29 commits from master into master 2013-06-16 19:30:26 +00:00
2 changed files with 11 additions and 20 deletions
Showing only changes of commit 63be7fefc1 - Show all commits

View File

@@ -107,13 +107,10 @@ public class DungeonHelper
private void initializeDungeons() private void initializeDungeons()
{ {
File file = new File(properties.CustomSchematicDirectory); File file = new File(properties.CustomSchematicDirectory);
String helpFile = "/mods/DimDoors/How_to_add_dungeons.txt"; if (file.exists() || file.mkdir())
if (new File(helpFile).exists())
{ {
copyfile.copyFile(helpFile, file + "/How_to_add_dungeons.txt"); copyfile.copyFile("/mods/DimDoors/How_to_add_dungeons.txt", file.getAbsolutePath() + "/How_to_add_dungeons.txt");
} }
file.mkdir();
registerFlipBlocks(); registerFlipBlocks();
importCustomDungeons(properties.CustomSchematicDirectory); importCustomDungeons(properties.CustomSchematicDirectory);
registerBaseDungeons(); registerBaseDungeons();

View File

@@ -1,6 +1,5 @@
package StevenDimDoors.mod_pocketDim.helpers; package StevenDimDoors.mod_pocketDim.helpers;
import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
@@ -9,29 +8,24 @@ import StevenDimDoors.mod_pocketDim.mod_pocketDim;
public class copyfile public class copyfile
{ {
public static boolean copyFile(String ori, String dest) public static boolean copyFile(String ori, String dest)
{ {
try try
{ {
InputStream in = (mod_pocketDim.class.getClass().getResourceAsStream(ori)); InputStream in = (mod_pocketDim.class.getClass().getResourceAsStream(ori));
OutputStream out = new FileOutputStream(dest); OutputStream out = new FileOutputStream(dest);
byte[] buf = new byte[1024]; byte[] buf = new byte[1024];
int len; int len;
while ((len = in.read(buf)) > 0) { while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len); out.write(buf, 0, len);
} }
in.close(); in.close();
out.close(); out.close();
} }
catch(Exception e) catch(Exception e)
{ {
//e.printStackTrace();
return false; return false;
} }
return true; return true;
} }
} }