Skip to content

Commit

Permalink
Remove pointless iterable.
Browse files Browse the repository at this point in the history
  • Loading branch information
wizjany committed Nov 17, 2019
1 parent 87162ac commit c413cf4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -47,7 +48,7 @@ public BukkitConfigurationManager(WorldGuardPlugin plugin) {
this.plugin = plugin;
}

public Iterable<BukkitWorldConfiguration> getWorldConfigs() {
public Collection<BukkitWorldConfiguration> getWorldConfigs() {
return worlds.values();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();
Expand All @@ -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())));
Expand Down

0 comments on commit c413cf4

Please sign in to comment.