Remove pointless iterable.

This commit is contained in:
wizjany 2019-11-10 11:34:56 -05:00
parent 87162acf11
commit c413cf4123
2 changed files with 10 additions and 9 deletions

View File

@ -26,6 +26,7 @@
import com.sk89q.worldedit.util.report.Unreported;
import java.io.File;
import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@ -47,7 +48,7 @@ public BukkitConfigurationManager(WorldGuardPlugin plugin) {
this.plugin = plugin;
}
public Iterable<BukkitWorldConfiguration> getWorldConfigs() {
public Collection<BukkitWorldConfiguration> getWorldConfigs() {
return worlds.values();
}

View File

@ -232,12 +232,12 @@ private void setupCustomCharts(Metrics metrics) {
int whitelisted = 0;
for (BukkitWorldConfiguration worldConfig : platform.getGlobalStateManager().getWorldConfigs()) {
Blacklist blacklist = worldConfig.getBlacklist();
if (blacklist == null || blacklist.isEmpty()) {
continue;
} else if (blacklist.isWhitelist()) {
whitelisted += blacklist.getItemCount();
} else {
blacklisted += blacklist.getItemCount();
if (blacklist != null && !blacklist.isEmpty()) {
if (blacklist.isWhitelist()) {
whitelisted += blacklist.getItemCount();
} else {
blacklisted += blacklist.getItemCount();
}
}
}
Map<String, Integer> blacklistCounts = new HashMap<>();
@ -246,9 +246,9 @@ private void setupCustomCharts(Metrics metrics) {
return blacklistCounts;
}));
metrics.addCustomChart(new Metrics.SimplePie("chest_protection", () ->
"" + Streams.stream(platform.getGlobalStateManager().getWorldConfigs()).anyMatch(cfg -> cfg.signChestProtection)));
"" + platform.getGlobalStateManager().getWorldConfigs().stream().anyMatch(cfg -> cfg.signChestProtection)));
metrics.addCustomChart(new Metrics.SimplePie("build_permissions", () ->
"" + Streams.stream(platform.getGlobalStateManager().getWorldConfigs()).anyMatch(cfg -> cfg.buildPermissions)));
"" + platform.getGlobalStateManager().getWorldConfigs().stream().anyMatch(cfg -> cfg.buildPermissions)));
metrics.addCustomChart(new Metrics.SimplePie("custom_flags", () ->
"" + (WorldGuard.getInstance().getFlagRegistry().size() > Flags.INBUILT_FLAGS.size())));