diff --git a/MobArena.jar b/MobArena.jar index e4b1b40..d12821e 100644 Binary files a/MobArena.jar and b/MobArena.jar differ diff --git a/bin/plugin.yml b/bin/plugin.yml index 007be50..b41decf 100644 --- a/bin/plugin.yml +++ b/bin/plugin.yml @@ -1,6 +1,6 @@ name: MobArena main: com.garbagemule.MobArena.MobArena -version: 0.87.2 +version: 0.87.3 commands: mobarena: description: Base command for MobArena diff --git a/src/com/garbagemule/MobArena/ArenaManager.java b/src/com/garbagemule/MobArena/ArenaManager.java index 1f8ef84..89d7eb5 100644 --- a/src/com/garbagemule/MobArena/ArenaManager.java +++ b/src/com/garbagemule/MobArena/ArenaManager.java @@ -221,11 +221,11 @@ public class ArenaManager return; } - if (ArenaManager.isRunning) - MAUtils.clearInventory(p); - if (playerSet.contains(p)) + { playerSet.remove(p); + MAUtils.clearInventory(p); + } if (readySet.contains(p)) readySet.remove(p); diff --git a/src/com/garbagemule/MobArena/MAUtils.java b/src/com/garbagemule/MobArena/MAUtils.java index f696280..1fee336 100644 --- a/src/com/garbagemule/MobArena/MAUtils.java +++ b/src/com/garbagemule/MobArena/MAUtils.java @@ -156,6 +156,60 @@ public class MAUtils // ///////////////////////////////////////////////////////////////////// */ + /** + * Replaces all tabs with 4 spaces in config.yml + + public static void fixConfigFile() + { + new File("plugins/MobArena").mkdir(); + File configFile = new File("plugins/MobArena/config.yml"); + + try + { + if(!configFile.exists()) + { + configFile.createNewFile(); + } + else + { + // Create an inputstream from the file + FileInputStream fis = new FileInputStream(configFile); + + // Read the file into a byte array, and make a String out of it. + byte[] bytes = new byte[(int)configFile.length()]; + fis.read(bytes); + String input = new String(bytes); + + // Close the stream. + fis.close(); + + // Replace all tabs with 4 spaces. + String output = ""; + for (char c : input.toCharArray()) + { + if (c == '\t') + output += " "; + else + output += c; + } + + // Create an outputstream from the file. + FileOutputStream fos = new FileOutputStream(configFile); + + // Write all the bytes to it. + for (byte b : output.getBytes()) + fos.write(b); + + // Close the stream. + fos.close(); + } + } + catch(Exception e) + { + System.out.println("[MobArena] ERROR: Config file could not be created."); + } + } + */ /** * Creates a Configuration object from the config.yml file. */ @@ -164,18 +218,18 @@ public class MAUtils new File("plugins/MobArena").mkdir(); File configFile = new File("plugins/MobArena/config.yml"); - if(!configFile.exists()) + try { - try + if(!configFile.exists()) { configFile.createNewFile(); } - catch(Exception e) - { - System.out.println("[MobArena] ERROR: Config file could not be created."); - return null; - } - } + } + catch(Exception e) + { + System.out.println("[MobArena] ERROR: Config file could not be created."); + return null; + } return new Configuration(configFile); }