public PlayerList(MinecraftServer minecraftserver) { minecraftserver.server = new CraftServer(minecraftserver, this); minecraftserver.console = org.bukkit.craftbukkit.command.ColouredConsoleSender.getInstance(); minecraftserver.reader.addCompleter(new org.bukkit.craftbukkit.command.ConsoleCommandCompleter(minecraftserver.server)); this.cserver = minecraftserver.server; // CraftBukkit end this.j = new GameProfileBanList(a); this.k = new IpBanList(b); this.operators = new OpList(c); this.whitelist = new WhiteList(d); this.n = Maps.newHashMap(); this.server = minecraftserver; this.j.a(false); this.k.a(false); this.maxPlayers = 8; }
public void a(EntityPlayer entityplayer) { int i = this.c.al(); HashMap hashmap = Maps.newHashMap(); if (this.g || i - this.f > 300) { this.f = i; Iterator iterator = this.c().iterator(); while (iterator.hasNext()) { Statistic statistic = (Statistic) iterator.next(); hashmap.put(statistic, Integer.valueOf(this.getStatisticValue(statistic))); } } entityplayer.playerConnection.sendPacket(new PacketPlayOutStatistic(hashmap)); }
public static boolean a(MinecraftServer minecraftserver) { GameProfileBanList gameprofilebanlist = new GameProfileBanList(PlayerList.a); if (b.exists() && b.isFile()) { if (gameprofilebanlist.c().exists()) { try { gameprofilebanlist.load(); // CraftBukkit start - FileNotFoundException -> IOException, don't print stacetrace } catch (IOException filenotfoundexception) { e.warn("Could not load existing file " + gameprofilebanlist.c().getName() + ", " + filenotfoundexception.getMessage()); } // CraftBukkit end } try { HashMap hashmap = Maps.newHashMap(); a(b, (Map) hashmap); GameProfileBanListEntryConverter gameprofilebanlistentryconverter = new GameProfileBanListEntryConverter(minecraftserver, hashmap, gameprofilebanlist); a(minecraftserver, hashmap.keySet(), gameprofilebanlistentryconverter); gameprofilebanlist.save(); c(b); return true; } catch (IOException ioexception) { e.warn("Could not read old user banlist 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 updateStatistics(EntityPlayer entityplayer) { HashMap hashmap = Maps.newHashMap(); Iterator iterator = AchievementList.e.iterator(); while (iterator.hasNext()) { Achievement achievement = (Achievement) iterator.next(); if (this.hasAchievement(achievement)) { hashmap.put(achievement, Integer.valueOf(this.getStatisticValue(achievement))); this.e.remove(achievement); } } entityplayer.playerConnection.sendPacket(new PacketPlayOutStatistic(hashmap)); }
public static boolean b(MinecraftServer minecraftserver) { IpBanList ipbanlist = new IpBanList(PlayerList.b); if (a.exists() && a.isFile()) { if (ipbanlist.c().exists()) { try { ipbanlist.load(); // CraftBukkit start - FileNotFoundException -> IOException, don't print stacetrace } catch (IOException filenotfoundexception) { e.warn("Could not load existing file " + ipbanlist.c().getName() + ", " + filenotfoundexception.getMessage()); } // CraftBukkit end } try { HashMap hashmap = Maps.newHashMap(); a(a, (Map) hashmap); Iterator iterator = hashmap.keySet().iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); String[] astring = (String[]) hashmap.get(s); Date date = astring.length > 1 ? b(astring[1], (Date) null) : null; String s1 = astring.length > 2 ? astring[2] : null; Date date1 = astring.length > 3 ? b(astring[3], (Date) null) : null; String s2 = astring.length > 4 ? astring[4] : null; ipbanlist.add(new IpBanEntry(s, date, s1, date1, s2)); } ipbanlist.save(); c(a); return true; } catch (IOException ioexception) { e.warn("Could not parse old ip banlist to convert it!", ioexception); return false; } } else { return true; } }
public Map a(String s) { JsonElement jsonelement = (new JsonParser()).parse(s); if (!jsonelement.isJsonObject()) { return Maps.newHashMap(); } else { JsonObject jsonobject = jsonelement.getAsJsonObject(); HashMap hashmap = Maps.newHashMap(); Iterator iterator = jsonobject.entrySet().iterator(); while (iterator.hasNext()) { Entry entry = (Entry) iterator.next(); Statistic statistic = StatisticList.getStatistic((String) entry.getKey()); if (statistic != null) { StatisticWrapper statisticwrapper = new StatisticWrapper(); if (((JsonElement) entry.getValue()).isJsonPrimitive() && ((JsonElement) entry.getValue()).getAsJsonPrimitive().isNumber()) { statisticwrapper.a(((JsonElement) entry.getValue()).getAsInt()); } else if (((JsonElement) entry.getValue()).isJsonObject()) { JsonObject jsonobject1 = ((JsonElement) entry.getValue()).getAsJsonObject(); if (jsonobject1.has("value") && jsonobject1.get("value").isJsonPrimitive() && jsonobject1.get("value").getAsJsonPrimitive().isNumber()) { statisticwrapper.a(jsonobject1.getAsJsonPrimitive("value").getAsInt()); } if (jsonobject1.has("progress") && statistic.l() != null) { try { Constructor constructor = statistic.l().getConstructor(new Class[0]); IJsonStatistic ijsonstatistic = (IJsonStatistic) constructor.newInstance(new Object[0]); ijsonstatistic.a(jsonobject1.get("progress")); statisticwrapper.a(ijsonstatistic); } catch (Throwable throwable) { b.warn("Invalid statistic progress in " + this.d, throwable); } } } hashmap.put(statistic, statisticwrapper); } else { b.warn("Invalid statistic in " + this.d + ": Don\'t know what " + (String) entry.getKey() + " is"); } } return hashmap; } }