public void QQ(){ BattleCraft.logger.info("Something went wrong boss..."); Bukkit.broadcastMessage("Something went wrong boss..."); } @SuppressWarnings("rawtypes") public synchronized boolean clearWorldReference(String worldName) { if (regionfiles == null) { QQ(); return false; } if (rafField == null) { QQ(); return false; } ArrayList removedKeys = new ArrayList(); worldName = worldName.replaceAll("/", "|"); int Cleared = 0; try { for (Object o : regionfiles.entrySet()) { Map.Entry e = (Map.Entry) o; File f = (File) e.getKey(); String f_string = f.toString().replace("\\", "|"); f_string = f_string.substring(2, f_string.length()); if (f_string.startsWith(worldName)) { RegionFile file = (RegionFile) e.getValue(); try { RandomAccessFile raf = (RandomAccessFile) rafField.get(file); if(raf != null && raf.length() != 0){ raf.close(); } removedKeys.add(f); Cleared += 1; } catch (Exception ex) { ex.printStackTrace(); } } } } catch (Exception ex) { plugin.getLogger().warning("Exception while removing world reference for '" + worldName + "'!"); ex.printStackTrace(); } for (Object key : removedKeys) regionfiles.remove(key); BattleCraft.logger.info("[ArenaManager] " + Cleared + " region files unloaded!"); return true; }