diff --git a/Plugins/Mineplex.ServerMonitor/.externalToolBuilders/New_Builder.launch b/Plugins/Mineplex.ServerMonitor/.externalToolBuilders/New_Builder.launch new file mode 100644 index 000000000..0c6e0f696 --- /dev/null +++ b/Plugins/Mineplex.ServerMonitor/.externalToolBuilders/New_Builder.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicServerData.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicServerData.java new file mode 100644 index 000000000..56b25f9cd --- /dev/null +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicServerData.java @@ -0,0 +1,26 @@ +package mineplex.servermonitor; + +import java.util.HashMap; + +public class DynamicServerData +{ + public String Name; + public String Address; + public int AvailableCPU = 32; + public int AvailableRAM = 26624; + + public HashMap ServerGroupCount = new HashMap(); + + public void setServerGroupCount(ServerGroupData groupData, int count) + { + if (ServerGroupCount.containsKey(groupData.Name)) + { + AvailableCPU += groupData.RequiredCPU * ServerGroupCount.get(groupData.Name); + AvailableRAM += groupData.RequiredRAM * ServerGroupCount.get(groupData.Name); + } + + ServerGroupCount.put(groupData.Name, count); + AvailableCPU -= groupData.RequiredCPU * count; + AvailableRAM -= groupData.RequiredRAM * count; + } +} diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicServerSorter.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicServerSorter.java new file mode 100644 index 000000000..d2fc1a589 --- /dev/null +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicServerSorter.java @@ -0,0 +1,30 @@ +package mineplex.servermonitor; + +import java.util.Comparator; + +public class DynamicServerSorter implements Comparator +{ + @Override + public int compare(DynamicServerData first, DynamicServerData second) + { + if (second.AvailableRAM <= 1024) + return -1; + + if (first.AvailableRAM <= 1024) + return 1; + + if (first.AvailableRAM > second.AvailableRAM) + return -1; + + if (second.AvailableRAM > first.AvailableRAM) + return 1; + + if (first.AvailableCPU > second.AvailableCPU) + return -1; + + if (second.AvailableCPU < first.AvailableCPU) + return 1; + + return 1; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerGroupData.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerGroupData.java new file mode 100644 index 000000000..e2da2c156 --- /dev/null +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerGroupData.java @@ -0,0 +1,12 @@ +package mineplex.servermonitor; + +public class ServerGroupData +{ + public String Name; + public String Prefix; + public String ScriptName; + public int RequiredRAM; + public int RequiredCPU; + public int RequiredTotalServers; + public int RequiredJoinableServers; +} diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerTargetData.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerTargetData.java new file mode 100644 index 000000000..df81111a7 --- /dev/null +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerTargetData.java @@ -0,0 +1,8 @@ +package mineplex.servermonitor; + +public class ServerTargetData +{ + public DynamicServerData DedicatedServer; + public int ServerNumber; + public String ServerGroup; +}