private String initPatterns(String x, ServerInfo serverInfo) { return x.replace("%server%", serverInfo.getServiceId().getServerId()) .replace("%id%", serverInfo.getServiceId().getId() + NetworkUtils.EMPTY_STRING) .replace("%host%", serverInfo.getHost()) .replace("%port%", serverInfo.getPort() + NetworkUtils.EMPTY_STRING) .replace("%memory%", serverInfo.getMemory() + "MB") .replace("%online_players%", serverInfo.getOnlineCount() + NetworkUtils.EMPTY_STRING) .replace("%max_players%", serverInfo.getMaxPlayers() + NetworkUtils.EMPTY_STRING) .replace("%motd%", ChatColor.translateAlternateColorCodes('&', serverInfo.getMotd())) .replace("%state%", serverInfo.getServerState().name() + NetworkUtils.EMPTY_STRING) .replace("%wrapper%", serverInfo.getServiceId().getWrapperId() + NetworkUtils.EMPTY_STRING) .replace("%extra%", serverInfo.getServerConfig().getExtra()) .replace("%template%", serverInfo.getTemplate().getName()) .replace("%group%", serverInfo.getServiceId().getGroup()); }
public Collection<String> freeServers(String group) { List<String> servers = new ArrayList<>(); for (ServerInfo serverInfo : getServers(group)) servers.add(serverInfo.getServiceId().getServerId()); for (Sign sign : signs.values()) if (sign.getServerInfo() != null && servers.contains(sign.getServerInfo().getServiceId().getServerId())) servers.remove(sign.getServerInfo().getServiceId().getServerId()); List<String> x = new ArrayList<>(); ServerInfo serverInfo; for (short i = 0; i < servers.size(); i++) { serverInfo = this.servers.get(servers.get(i)); if (serverInfo != null) { if (!serverInfo.isOnline() || !serverInfo.getServerState().equals(ServerState.LOBBY) || serverInfo.getServerConfig().isHideServer() || serverInfo.getMotd().contains("INGAME") || serverInfo.getMotd().contains("RUNNING") || serverInfo.getServerConfig().isHideServer()) x.add(serverInfo.getServiceId().getServerId()); } else x.add(servers.get(i)); } for (String b : x) servers.remove(b); Collections.sort(servers); return servers; }
public void updateArray(String[] value, ServerInfo serverInfo) { short i = 0; for (String x : value) { value[i] = ChatColor.translateAlternateColorCodes('&', x .replace("%server%", serverInfo.getServiceId().getServerId() + NetworkUtils.EMPTY_STRING) .replace("%id%", serverInfo.getServiceId().getId() + NetworkUtils.EMPTY_STRING) .replace("%host%", serverInfo.getHost()) .replace("%port%", serverInfo.getPort() + NetworkUtils.EMPTY_STRING) .replace("%memory%", serverInfo.getMemory() + "MB") .replace("%online_players%", serverInfo.getOnlineCount() + NetworkUtils.EMPTY_STRING) .replace("%max_players%", serverInfo.getMaxPlayers() + NetworkUtils.EMPTY_STRING) .replace("%motd%", ChatColor.translateAlternateColorCodes('&', serverInfo.getMotd())) .replace("%state%", serverInfo.getServerState().name() + NetworkUtils.EMPTY_STRING) .replace("%wrapper%", serverInfo.getServiceId().getWrapperId() + NetworkUtils.EMPTY_STRING) .replace("%extra%", serverInfo.getServerConfig().getExtra()) .replace("%template%", serverInfo.getTemplate().getName()) .replace("%group%", serverInfo.getServiceId().getGroup())); i++; } }
if (server.isOnline() && server.getServerState().equals(ServerState.LOBBY) && !server.getServerConfig().isHideServer() && !server.getServerConfig() .getProperties().contains(NetworkUtils.DEV_PROPERTY))
continue; TextComponent textComponent = new TextComponent(TextComponent.fromLegacyText("§8[§c" + simpleProxyInfo.getServiceId().getServerId() + "§8] §8(§e" + simpleProxyInfo.getOnlineCount() + "§8) §e" + simpleProxyInfo.getServerState().name() + " §8: §7" + simpleProxyInfo.getMemory() + "MB")); textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/server " + simpleProxyInfo.getServiceId().getServerId())); commandSender.sendMessage(textComponent); serverInfo.getServerState().name() + " §8: §7" + serverInfo.getMemory() + "MB")); for (ServerInfo server : CloudProxy.getInstance().getCachedServers().values()) TextComponent textComponent = new TextComponent(TextComponent.fromLegacyText("§7- " + (server.isOnline() ? "§e" : "§c") + server.getServiceId().getServerId() + "§8(" + server.getOnlineCount() + "§8) §7State: " + server.getServerState())); textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/server " + server.getServiceId().getServerId())); commandSender.sendMessage(textComponent);
if (serverInfo.getOnlineCount() < serverInfo.getMaxPlayers() && serverInfo.getServerState().equals(ServerState.LOBBY))
NetworkUtils.SPACE_STRING, "Connection: " + (minecraftServer.getChannel() != null ? "connected" : "not connected"), "State: " + (minecraftServer.getServerInfo().isOnline() ? "Online" : "Offline") + " | " + minecraftServer.getServerInfo().getServerState(), "Online: " + minecraftServer.getServerInfo().getOnlineCount() + NetworkUtils.SLASH_STRING + minecraftServer.getServerInfo().getMaxPlayers(), "Motd: " + minecraftServer.getServerInfo().getMotd(),