A few bugfixes.

This commit is contained in:
Olof Larsson 2012-08-31 13:40:18 +02:00
parent 541b6ffd1e
commit eba582f3f3
3 changed files with 6 additions and 2 deletions

View File

@ -52,6 +52,9 @@ public class MCore extends MPlugin
// Register events // Register events
this.listener = new InternalListener(this); this.listener = new InternalListener(this);
if ( ! preEnable()) return;
this.postEnable();
} }
} }

View File

@ -46,6 +46,7 @@ public abstract class GsonClassManager<T> implements IClassManager<T>
protected boolean didLoadAll = false; protected boolean didLoadAll = false;
protected void loadIds() protected void loadIds()
{ {
if ( ! this.getFolder().exists()) return;
for(File file : this.getFolder().listFiles(JsonFileFilter.getInstance())) for(File file : this.getFolder().listFiles(JsonFileFilter.getInstance()))
{ {
this.ids.add(this.idFromFile(file)); this.ids.add(this.idFromFile(file));

View File

@ -19,8 +19,6 @@ public class DiscUtil
public static byte[] readBytes(File file) throws IOException public static byte[] readBytes(File file) throws IOException
{ {
File parent = file.getParentFile();
if (parent != null && !parent.exists()) parent.mkdirs();
int length = (int) file.length(); int length = (int) file.length();
byte[] output = new byte[length]; byte[] output = new byte[length];
InputStream in = new FileInputStream(file); InputStream in = new FileInputStream(file);
@ -36,6 +34,8 @@ public class DiscUtil
public static void writeBytes(File file, byte[] bytes) throws IOException public static void writeBytes(File file, byte[] bytes) throws IOException
{ {
File parent = file.getParentFile();
if (parent != null && !parent.exists()) parent.mkdirs();
FileOutputStream out = new FileOutputStream(file); FileOutputStream out = new FileOutputStream(file);
out.write(bytes); out.write(bytes);
out.close(); out.close();