Reverted Hub.

Fixed server monitor issues.
This commit is contained in:
Jonathan Williams 2014-01-14 02:04:06 -06:00
parent ea320e7f5b
commit 8e51e4061a
9 changed files with 24 additions and 23 deletions

View File

@ -13,10 +13,10 @@ public class LobbySorter implements Comparator<ServerStatusData>
if (first.Players == 999)
return 1;
if (first.MaxPlayers - first.Players > 10 && second.MaxPlayers - second.Players <= 10)
if (first.MaxPlayers - first.Players > 15 && second.MaxPlayers - second.Players <= 15)
return -1;
if (second.MaxPlayers - second.Players > 10 && first.MaxPlayers - first.Players <= 10)
if (second.MaxPlayers - second.Players > 15 && first.MaxPlayers - first.Players <= 15)
return 1;
if (first.Players < (first.MaxPlayers / 2) && second.Players >= (second.MaxPlayers / 2))

View File

@ -68,7 +68,7 @@ import mineplex.minecraft.game.core.condition.ConditionManager;
public class HubManager extends MiniClientPlugin<HubClient>
{
public String Mode = "Christmas";
public String Mode = "Normal";
private BlockRestore _blockRestore;
private CoreClientManager _clientManager;

View File

@ -34,8 +34,6 @@ public class NewsManager extends MiniPlugin
_news = new String[]
{
"Europe Servers: " + C.cGreen + C.Bold + "BACK ONLINE" + ChatColor.RESET + "!",
"Christmas Sale: " + C.cGreen + C.Bold + "50% Off!" + ChatColor.RESET + "!",
"New Game: " + C.cGold + C.Bold + "Christmas Chaos" + ChatColor.RESET + "!",
"New SSM Kit: " + C.cYellow + C.Bold + "Magma Cube" + ChatColor.RESET + "!",
"New Rank: " + C.cPurple + C.Bold + "Hero Rank" + ChatColor.RESET + "!",
};

View File

@ -25,7 +25,7 @@ public class LobbyMenu extends ShopPageBase<ServerManager, LobbyShop> implements
public LobbyMenu(ServerManager plugin, LobbyShop lobbyShop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, String serverGroup)
{
super(plugin, lobbyShop, clientManager, donationManager, name, player, 36);
super(plugin, lobbyShop, clientManager, donationManager, name, player, 54);
_serverGroup = serverGroup;
@ -55,7 +55,7 @@ public class LobbyMenu extends ShopPageBase<ServerManager, LobbyShop> implements
Material status = Material.IRON_BLOCK;
List<String> lore = new ArrayList<String>();
if (slot >= 36)
if (slot >= 54)
break;
if (serverInfo.Name.equalsIgnoreCase(Plugin.getStatusManager().getCurrentServerName()))
@ -83,7 +83,7 @@ public class LobbyMenu extends ShopPageBase<ServerManager, LobbyShop> implements
slot += 1;
}
while (slot < 36)
while (slot < 54)
{
setItem(slot, null);
slot++;

View File

@ -17,11 +17,11 @@ public class Repository
private String _password = "y2D4atu3Pene2asw";
private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS ServerStatus (id INT NOT NULL AUTO_INCREMENT, serverName VARCHAR(256), serverGroup VARCHAR(256), address VARCHAR(256), updated LONG, lastTimeWithPlayers LONG, motd VARCHAR(256), players INT, maxPlayers INT, tps INT, ram INT, maxRam INT, PRIMARY KEY (id));";
private static String RETRIEVE_OLD_SERVER_STATUSES = "SELECT ServerStatus.serverName, ServerStatus.address, motd, players, maxPlayers FROM ServerStatus INNER JOIN DynamicServers ON ServerStatus.address LIKE CONCAT(DynamicServers.privateAddress, '%') WHERE DynamicServers.US = false AND TIME_TO_SEC(TIMEDIFF(now(), ServerStatus.updated)) > 10;";
private static String RETRIEVE_OLD_SERVER_STATUSES = "SELECT ServerStatus.serverName, DynamicServers.address, ServerStatus.address, motd, players, maxPlayers FROM ServerStatus INNER JOIN DynamicServers ON ServerStatus.address LIKE CONCAT(DynamicServers.privateAddress, '%') WHERE DynamicServers.US = false AND TIME_TO_SEC(TIMEDIFF(now(), ServerStatus.updated)) > 10;";
private static String CREATE_DYNAMIC_TABLE = "CREATE TABLE IF NOT EXISTS DynamicServers (id INT NOT NULL AUTO_INCREMENT, serverName VARCHAR(256), address VARCHAR(256), privateAddress VARCHAR(256), US BOOLEAN NOT NULL DEFAULT 'true', PRIMARY KEY (id));";
private static String RETRIEVE_AVAILABLE_SERVERS = "SELECT DynamicServers.serverName, DynamicServers.address, DynamicServers.privateAddress, DynamicServers.US, DynamicServers.availableCpu, DynamicServers.availableRam, ServerStatus.serverGroup, COUNT(*) As serverCount FROM DynamicServers LEFT JOIN ServerStatus ON ServerStatus.address LIKE CONCAT(DynamicServers.privateAddress, '%') WHERE DynamicServers.US = false GROUP BY DynamicServers.address, ServerStatus.serverGroup;";
private static String RETRIEVE_SERVERGROUP_STATUSES = "SELECT ServerStatus.serverName, serverGroup, motd, ServerStatus.address, players, maxPlayers, case when TIME_TO_SEC(TIMEDIFF(now(), ServerStatus.lastTimeWithPlayers)) > 300 then 1 else 0 end as empty FROM ServerStatus INNER JOIN DynamicServers ON ServerStatus.address LIKE CONCAT(DynamicServers.privateAddress, '%') WHERE DynamicServers.US = false AND TIME_TO_SEC(TIMEDIFF(now(), ServerStatus.updated)) <= 10";
private static String RETRIEVE_SERVERGROUP_STATUSES = "SELECT ServerStatus.serverName, serverGroup, motd, DynamicServers.address, ServerStatus.address, players, maxPlayers, case when TIME_TO_SEC(TIMEDIFF(now(), ServerStatus.lastTimeWithPlayers)) > 300 then 1 else 0 end as empty FROM ServerStatus INNER JOIN DynamicServers ON ServerStatus.address LIKE CONCAT(DynamicServers.privateAddress, '%') WHERE DynamicServers.US = false AND TIME_TO_SEC(TIMEDIFF(now(), ServerStatus.updated)) <= 10";
private static String RETRIEVE_SERVER_GROUP_DATA = "SELECT groupName, prefix, scriptName, requiredRam, cpuRequired, requiredTotal, requiredJoinable FROM ServerGroups;";
private static String DELETE_SERVER_STATUS = "DELETE FROM ServerStatus WHERE address = ? AND serverName = ?;";
@ -111,12 +111,13 @@ public class Repository
serverStatusData.Name = resultSet.getString(1);
String addressPortString = resultSet.getString(2);
serverStatusData.Address = addressPortString.split(":")[0];
serverStatusData.Address = resultSet.getString(2);
String addressPortString = resultSet.getString(3);
serverStatusData.PrivateAddress = addressPortString.split(":")[0];
serverStatusData.Port = Integer.parseInt(addressPortString.split(":")[1]);
serverStatusData.Motd = resultSet.getString(3);
serverStatusData.Players = resultSet.getInt(4);
serverStatusData.MaxPlayers = resultSet.getInt(5);
serverStatusData.Motd = resultSet.getString(4);
serverStatusData.Players = resultSet.getInt(5);
serverStatusData.MaxPlayers = resultSet.getInt(6);
serverData.add(serverStatusData);
}
@ -176,12 +177,13 @@ public class Repository
serverStatusData.Name = resultSet.getString(1);
String serverGroup = resultSet.getString(2);
serverStatusData.Motd = resultSet.getString(3);
String addressPortString = resultSet.getString(4);
serverStatusData.Address = addressPortString.split(":")[0];
serverStatusData.Address = resultSet.getString(4);
String addressPortString = resultSet.getString(5);
serverStatusData.PrivateAddress = addressPortString.split(":")[0];
serverStatusData.Port = Integer.parseInt(addressPortString.split(":")[1]);
serverStatusData.Players = resultSet.getInt(5);
serverStatusData.MaxPlayers = resultSet.getInt(6);
serverStatusData.Empty = resultSet.getBoolean(7);
serverStatusData.Players = resultSet.getInt(6);
serverStatusData.MaxPlayers = resultSet.getInt(7);
serverStatusData.Empty = resultSet.getBoolean(8);
if (!groupData.containsKey(serverGroup))
{
@ -390,7 +392,7 @@ public class Repository
connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = connection.prepareStatement(DELETE_SERVER_STATUS);
preparedStatement.setString(1, serverToKill.Address + ":" + serverToKill.Port);
preparedStatement.setString(1, serverToKill.PrivateAddress + ":" + serverToKill.Port);
preparedStatement.setString(2, serverToKill.Name);
preparedStatement.execute();
}

View File

@ -7,6 +7,7 @@ public class ServerStatusData
public int Players;
public int MaxPlayers;
public String Address;
public String PrivateAddress;
public int Port;
public boolean Empty = false;
}

Binary file not shown.