mirror of
https://github.com/BGHDDevelopment/PlayerBalancer.git
synced 2024-11-09 04:20:32 +01:00
Fixed an mistake that was making the ping manager not behave correctly
This commit is contained in:
parent
58bc50ad65
commit
a32319df28
@ -13,12 +13,12 @@ public class ConfigEntries implements ConfigEntryHolder {
|
||||
public static final ConfigEntry<Boolean> CHECK_UPDATES_ENABLED = new ConfigEntry<>(0, "settings.check-updates", true);
|
||||
public static final ConfigEntry<Boolean> SUBMIT_STATS = new ConfigEntry<>(0, "settings.submit-stats", true);
|
||||
|
||||
public static final ConfigEntry<Boolean> SERVER_CHECK_ENABLED = new ConfigEntry<>(0, "settings.server_check.enabled", true);
|
||||
public static final ConfigEntry<String> SERVER_CHECK_MODE = new ConfigEntry<>(0, "settings.server_check.tactic", "CUSTOM");
|
||||
public static final ConfigEntry<Integer> SERVER_CHECK_ATTEMPTS = new ConfigEntry<>(0, "settings.server_check.attempts", 5);
|
||||
public static final ConfigEntry<Integer> SERVER_CHECK_INTERVAL = new ConfigEntry<>(0, "settings.server_check.interval", 10000);
|
||||
public static final ConfigEntry<Boolean> SERVER_CHECK_PRINT_INFO = new ConfigEntry<>(0, "settings.server_check.print-info", false);
|
||||
public static final ConfigEntry<List<String>> SERVER_CHECK_MARKER_DESCS = new ConfigEntry<>(0, "settings.server_check.marker-descs", Arrays.asList("Server is not accessible", "Gamemode has already started"));
|
||||
public static final ConfigEntry<Boolean> SERVER_CHECK_ENABLED = new ConfigEntry<>(0, "settings.server-check.enabled", true);
|
||||
public static final ConfigEntry<String> SERVER_CHECK_MODE = new ConfigEntry<>(0, "settings.server-check.tactic", "CUSTOM");
|
||||
public static final ConfigEntry<Integer> SERVER_CHECK_ATTEMPTS = new ConfigEntry<>(0, "settings.server-check.attempts", 5);
|
||||
public static final ConfigEntry<Integer> SERVER_CHECK_INTERVAL = new ConfigEntry<>(0, "settings.server-check.interval", 10000);
|
||||
public static final ConfigEntry<Boolean> SERVER_CHECK_PRINT_INFO = new ConfigEntry<>(0, "settings.server-check.print-info", false);
|
||||
public static final ConfigEntry<List<String>> SERVER_CHECK_MARKER_DESCS = new ConfigEntry<>(0, "settings.server-check.marker-descs", Arrays.asList("Server is not accessible", "Gamemode has already started"));
|
||||
|
||||
public static final ConfigEntry<Boolean> GEOLOCATION_ENABLED = new ConfigEntry<>(0, "settings.geolocation.enabled", true);
|
||||
public static final ConfigEntry<Boolean> GEOLOCATION_PRINT_INFO = new ConfigEntry<>(0, "settings.geolocation.print-info", true);
|
||||
|
@ -2,6 +2,7 @@ package me.jaimemartz.lobbybalancer.ping;
|
||||
|
||||
import me.jaimemartz.lobbybalancer.LobbyBalancer;
|
||||
import me.jaimemartz.lobbybalancer.configuration.ConfigEntries;
|
||||
import net.md_5.bungee.api.config.ConfigurationAdapter;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.scheduler.ScheduledTask;
|
||||
|
||||
@ -27,10 +28,14 @@ public class PingManager {
|
||||
stopped = false;
|
||||
tactic = PingTacticType.valueOf((ConfigEntries.SERVER_CHECK_MODE.get()).toUpperCase());
|
||||
plugin.getLogger().info(String.format("Starting the ping task, the interval is %s", ConfigEntries.SERVER_CHECK_INTERVAL.get()));
|
||||
ConfigurationAdapter adapter = plugin.getProxy().getConfigurationAdapter();
|
||||
task = plugin.getProxy().getScheduler().schedule(plugin, () -> {
|
||||
for (ServerInfo server : plugin.getProxy().getServers().values()) {
|
||||
if (stopped) break;
|
||||
if (server != null) {
|
||||
if (stopped) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (server != null && adapter.getServers().containsKey(server.getName())) {
|
||||
track(server);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user