public void load() throws IOException { // CraftBukkit - Added throws Collection collection = null; BufferedReader bufferedreader = null; try { bufferedreader = Files.newReader(this.c, Charsets.UTF_8); collection = (Collection) this.b.fromJson(bufferedreader, f); } finally { IOUtils.closeQuietly(bufferedreader); } if (collection != null) { this.d.clear(); Iterator iterator = collection.iterator(); while (iterator.hasNext()) { JsonListEntry jsonlistentry = (JsonListEntry) iterator.next(); if (jsonlistentry.getKey() != null) { this.d.put(this.a(jsonlistentry.getKey()), jsonlistentry); } } } }
static List a(File file1, Map map) throws IOException { // CraftBukkit - Added throws List list = Files.readLines(file1, Charsets.UTF_8); Iterator iterator = list.iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); s = s.trim(); if (!s.startsWith("#") && s.length() >= 1) { String[] astring = s.split("\\|"); map.put(astring[0].toLowerCase(Locale.ROOT), astring); } } return list; }
public void c() { String s = this.b.toJson(this.a(org.spigotmc.SpigotConfig.userCacheCap)); BufferedWriter bufferedwriter = null; try { bufferedwriter = Files.newWriter(this.g, Charsets.UTF_8); bufferedwriter.write(s); return; } catch (FileNotFoundException filenotfoundexception) { return; } catch (IOException ioexception) { ; } finally { IOUtils.closeQuietly(bufferedwriter); } }
public void save() throws IOException { // CraftBukkit - Added throws Collection collection = this.d.values(); String s = this.b.toJson(collection); BufferedWriter bufferedwriter = null; try { bufferedwriter = Files.newWriter(this.c, Charsets.UTF_8); bufferedwriter.write(s); } finally { IOUtils.closeQuietly(bufferedwriter); } }
public static boolean c(MinecraftServer minecraftserver) { OpList oplist = new OpList(PlayerList.c); if (c.exists() && c.isFile()) { if (oplist.c().exists()) { try { oplist.load(); // CraftBukkit start - FileNotFoundException -> IOException, don't print stacetrace } catch (IOException filenotfoundexception) { e.warn("Could not load existing file " + oplist.c().getName() + ", " + filenotfoundexception.getMessage()); } // CraftBukkit end } try { List list = Files.readLines(c, Charsets.UTF_8); OpListProfileCallback oplistprofilecallback = new OpListProfileCallback(minecraftserver, oplist); a(minecraftserver, list, oplistprofilecallback); oplist.save(); c(c); return true; } catch (IOException ioexception) { e.warn("Could not read old oplist to convert it!", ioexception); return false; } catch (FileConversionException fileconversionexception) { e.error("Conversion failed, please try again later", fileconversionexception); return false; } } else { return true; } }
public static boolean d(MinecraftServer minecraftserver) { WhiteList whitelist = new WhiteList(PlayerList.d); if (d.exists() && d.isFile()) { if (whitelist.c().exists()) { try { whitelist.load(); // CraftBukkit start - FileNotFoundException -> IOException, don't print stacetrace } catch (IOException filenotfoundexception) { e.warn("Could not load existing file " + whitelist.c().getName() + ", " + filenotfoundexception.getMessage()); } // CraftBukkit end } try { List list = Files.readLines(d, Charsets.UTF_8); WhiteListProfileCallback whitelistprofilecallback = new WhiteListProfileCallback(minecraftserver, whitelist); a(minecraftserver, list, whitelistprofilecallback); whitelist.save(); c(d); return true; } catch (IOException ioexception) { e.warn("Could not read old whitelist to convert it!", ioexception); return false; } catch (FileConversionException fileconversionexception) { e.error("Conversion failed, please try again later", fileconversionexception); return false; } } else { return true; } }
public void b() { List list = null; BufferedReader bufferedreader = null; label81: { try { bufferedreader = Files.newReader(this.g, Charsets.UTF_8); list = (List) this.b.fromJson(bufferedreader, h); break label81; } catch (FileNotFoundException filenotfoundexception) { ; // Spigot Start } catch (net.minecraft.util.com.google.gson.JsonSyntaxException ex) { JsonList.a.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." ); this.g.delete(); // Spigot End } finally { IOUtils.closeQuietly(bufferedreader); } return; } if (list != null) { this.c.clear(); this.d.clear(); LinkedList linkedlist = this.e; synchronized (this.e) { this.e.clear(); } list = Lists.reverse(list); Iterator iterator = list.iterator(); while (iterator.hasNext()) { UserCacheEntry usercacheentry = (UserCacheEntry) iterator.next(); if (usercacheentry != null) { this.a(usercacheentry.a(), usercacheentry.b()); } } } }