ServerMonitor files.

This commit is contained in:
Jonathan Williams 2013-11-06 09:14:08 -08:00
parent 2e7bd5504a
commit 0a50d9b127
5 changed files with 93 additions and 0 deletions

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="ServerMonitor,"/>
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="ServerMonitor,"/>
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="ServerMonitor,"/>
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${BUILD_FILES}/common.xml"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Mineplex.ServerMonitor}"/>
</launchConfiguration>

View File

@ -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<String, Integer> ServerGroupCount = new HashMap<String, Integer>();
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;
}
}

View File

@ -0,0 +1,30 @@
package mineplex.servermonitor;
import java.util.Comparator;
public class DynamicServerSorter implements Comparator<DynamicServerData>
{
@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;
}
}

View File

@ -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;
}

View File

@ -0,0 +1,8 @@
package mineplex.servermonitor;
public class ServerTargetData
{
public DynamicServerData DedicatedServer;
public int ServerNumber;
public String ServerGroup;
}