Skip to content
Permalink
Browse files

Remove pointless iterable.

  • Loading branch information
wizjany committed Nov 10, 2019
1 parent 87162ac commit c413cf4123aabf4d4e989ee69e90f70a441acd51
@@ -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();
}

@@ -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())));

0 comments on commit c413cf4

Please sign in to comment.
You can’t perform that action at this time.