Less console spam

This commit is contained in:
Jaime Martínez Rincón 2017-09-27 19:31:23 +02:00
parent c852c91f7a
commit d351739564

View File

@ -40,6 +40,7 @@ public class SectionManager {
} }
if (plugin.getSettings().getServerRefreshProps().isEnabled()) { if (plugin.getSettings().getServerRefreshProps().isEnabled()) {
plugin.getLogger().info("Starting automatic server refresh task");
refreshTask = plugin.getProxy().getScheduler().schedule(plugin, () -> { refreshTask = plugin.getProxy().getScheduler().schedule(plugin, () -> {
props.getSectionProps().forEach((name, props) -> { props.getSectionProps().forEach((name, props) -> {
ServerSection section = sections.get(name); ServerSection section = sections.get(name);
@ -271,22 +272,26 @@ public class SectionManager {
} }
}); });
results.forEach(server -> { int addedServers = 0;
for (ServerInfo server : results) {
if (!section.getServers().contains(server)) { if (!section.getServers().contains(server)) {
section.getServers().add(server); section.getServers().add(server);
register(server, section); register(server, section);
addedServers++;
plugin.getLogger().info(String.format("Added the server %s to %s", plugin.getLogger().info(String.format("Added the server %s to %s",
server.getName(), section.getName() server.getName(), section.getName()
)); ));
} }
}); }
if (addedServers > 0) {
plugin.getLogger().info(String.format("Recognized %s server%s in the section \"%s\"", plugin.getLogger().info(String.format("Recognized %s server%s in the section \"%s\"",
results.size(), addedServers,
results.size() != 1 ? "s" : "", addedServers != 1 ? "s" : "",
section.getName() section.getName()
)); ));
} }
}
public int calculatePosition(ServerSection section) { public int calculatePosition(ServerSection section) {
ServerSection current = section; ServerSection current = section;