--- a/net/minecraft/stats/ServerStatsCounter.java +++ b/net/minecraft/stats/ServerStatsCounter.java @@ -1,3 +1,4 @@ +// mc-dev import package net.minecraft.stats; import com.google.common.collect.Maps; @@ -47,6 +48,13 @@ public ServerStatsCounter(MinecraftServer server, File file) { this.server = server; this.file = file; + // Spigot start + for ( Map.Entry entry : org.spigotmc.SpigotConfig.forcedStats.entrySet() ) + { + Stat wrapper = Stats.CUSTOM.get( entry.getKey() ); + this.stats.put( wrapper, entry.getValue().intValue() ); + } + // Spigot end if (file.isFile()) { try { this.parseLocal(server.getFixerUpper(), FileUtils.readFileToString(file)); @@ -60,6 +68,7 @@ } public void save() { + if ( org.spigotmc.SpigotConfig.disableStatSaving ) return; // Spigot try { FileUtils.writeStringToFile(this.file, this.toJson()); } catch (IOException ioexception) { @@ -70,6 +79,7 @@ @Override public void setValue(Player player, Stat stat, int value) { + if ( org.spigotmc.SpigotConfig.disableStatSaving ) return; // Spigot super.setValue(player, stat, value); this.dirty.add(stat); } @@ -158,13 +168,12 @@ } private Optional> getStat(StatType type, String id) { - Optional optional = Optional.ofNullable(ResourceLocation.tryParse(id)); - Registry iregistry = type.getRegistry(); + // CraftBukkit - decompile error start + Optional optional = Optional.ofNullable(ResourceLocation.tryParse(id)); + Registry iregistry = type.getRegistry(); - Objects.requireNonNull(iregistry); - optional = optional.flatMap(iregistry::getOptional); - Objects.requireNonNull(type); - return optional.map(type::get); + return optional.flatMap(iregistry::getOptional).map(type::get); + // CraftBukkit - decompile error end } private static CompoundTag fromJson(JsonObject json) {