Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex into alex-ctf
This commit is contained in:
commit
f05cdd4915
@ -61,6 +61,9 @@ public class CoreClient
|
||||
|
||||
public Rank GetRank()
|
||||
{
|
||||
if (_rank == null)
|
||||
_rank = Rank.ALL;
|
||||
|
||||
return _rank;
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,6 @@ public class CoreClientManager extends MiniPlugin
|
||||
if (client == null)
|
||||
{
|
||||
client = new CoreClient(name);
|
||||
client.SetRank(Rank.ALL);
|
||||
}
|
||||
|
||||
return client;
|
||||
|
@ -151,7 +151,7 @@ public class LoadingWindow implements Runnable, Listener {
|
||||
{
|
||||
Player player = Bukkit.getPlayer(_playersUUID);
|
||||
|
||||
if (player == null || _inv == null ? !player.getOpenInventory().equals(_currentInventory) : (_inv != null && !player.getOpenInventory().getTopInventory().equals(_inv))) {
|
||||
if (player == null || player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null || _inv == null ? !player.getOpenInventory().equals(_currentInventory) : (_inv != null && !player.getOpenInventory().getTopInventory().equals(_inv))) {
|
||||
end();
|
||||
return;
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -42,10 +44,12 @@ public class ServerMonitor
|
||||
private static Map<String, ServerGroup> _serverGroupMap = null;
|
||||
private static List<DedicatedServer> _dedicatedServers = null;
|
||||
private static HashSet<String> _deadServers = new HashSet<String>();
|
||||
private static HashSet<String> _delayedKill = new HashSet<String>();
|
||||
private static HashSet<String> _laggyServers = new HashSet<String>();
|
||||
|
||||
private static SimpleDateFormat _dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
|
||||
private static Logger _logger = Logger.getLogger("ServerMonitor");
|
||||
private static Timer _timer = new Timer();
|
||||
|
||||
private static int _totalPlayers = 0;
|
||||
private static Region _region;
|
||||
@ -124,12 +128,15 @@ public class ServerMonitor
|
||||
|
||||
for (MinecraftServer minecraftServer : _serverStatuses)
|
||||
{
|
||||
if (minecraftServer.getMotd().contains("Finished") || (minecraftServer.getGroup().equalsIgnoreCase("UltraHardcore") && minecraftServer.getMotd().contains("Restarting") && minecraftServer.getPlayerCount() == 0))
|
||||
if (!ignoreServer(minecraftServer.getGroup()))
|
||||
{
|
||||
killServer(minecraftServer.getName(), minecraftServer.getPublicAddress(), minecraftServer.getPlayerCount(), "[KILLED] [FINISHED] " + minecraftServer.getName() + ":" + minecraftServer.getPublicAddress(), true);
|
||||
if (minecraftServer.getMotd().contains("Finished") || (minecraftServer.getGroup().equalsIgnoreCase("UltraHardcore") && minecraftServer.getMotd().contains("Restarting") && minecraftServer.getPlayerCount() == 0))
|
||||
{
|
||||
killServer(minecraftServer.getName(), minecraftServer.getPublicAddress(), minecraftServer.getPlayerCount(), "[KILLED] [FINISHED] " + minecraftServer.getName() + ":" + minecraftServer.getPublicAddress(), true);
|
||||
|
||||
handleUserServerGroup(_serverGroupMap.get(minecraftServer.getGroup()));
|
||||
continue;
|
||||
handleUserServerGroup(_serverGroupMap.get(minecraftServer.getGroup()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (DedicatedServer server : _dedicatedServers)
|
||||
@ -202,6 +209,9 @@ public class ServerMonitor
|
||||
|
||||
for (ServerGroup groupStatus : _serverGroups)
|
||||
{
|
||||
if (ignoreServer(groupStatus.getName()))
|
||||
continue;
|
||||
|
||||
NautHashMap<Integer, MinecraftServer> serverMap = new NautHashMap<Integer, MinecraftServer>();
|
||||
|
||||
for (Iterator<MinecraftServer> serverIterator = groupStatus.getServers().iterator(); serverIterator.hasNext();)
|
||||
@ -226,17 +236,6 @@ public class ServerMonitor
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (groupStatus.getHost() == null || groupStatus.getHost().isEmpty())
|
||||
{
|
||||
if (groupStatus.getName().startsWith("0"))
|
||||
{
|
||||
int serverCount = groupStatus.getServers().size();
|
||||
log(groupStatus.getName() + " : " + groupStatus.getPlayerCount() + " players on " + serverCount + " servers " + String.format("%.2f", ((double)serverCount * (double)groupStatus.getRequiredCpu() / totalCPU)) + "% CPU," + String.format("%.2f", ((double)serverCount * (double)groupStatus.getRequiredRam() / totalRAM)) + "% RAM", false);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
HashSet<String> onlineServers = new HashSet<String>();
|
||||
@ -386,21 +385,35 @@ public class ServerMonitor
|
||||
deadServers.addAll(_deadServers);
|
||||
|
||||
_deadServers.clear();
|
||||
for (MinecraftServer deadServer : _repository.getDeadServers())
|
||||
for (final MinecraftServer deadServer : _repository.getDeadServers())
|
||||
{
|
||||
if (deadServer.getUptime() <= 10 || ignoreServer(deadServer.getGroup()))
|
||||
continue;
|
||||
|
||||
if (_count == 0 || deadServers.contains(deadServer.getName()))
|
||||
{
|
||||
copyServerLog(deadServer);
|
||||
killServer(deadServer.getName(), deadServer.getPublicAddress(), deadServer.getPlayerCount(), "[KILLED] [DEAD] " + deadServer.getName() + ":" + deadServer.getPublicAddress(), true);
|
||||
|
||||
handleUserServerGroup(_serverGroupMap.get(deadServer.getGroup()));
|
||||
}
|
||||
else
|
||||
else if (!_delayedKill.contains(deadServer.getName()))
|
||||
{
|
||||
_deadServers.add(deadServer.getName());
|
||||
log("[IMPENDING DEATH] : " + deadServer.getName() + ":" + deadServer.getPublicAddress());
|
||||
startTimingReport(deadServer);
|
||||
|
||||
_timer.schedule(new TimerTask()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_deadServers.add(deadServer.getName());
|
||||
_delayedKill.remove(deadServer.getName());
|
||||
|
||||
stopTimingReport(deadServer);
|
||||
log("[IMPENDING DEATH] : " + deadServer.getName() + ":" + deadServer.getPublicAddress());
|
||||
}
|
||||
}, 20 * 1000);
|
||||
|
||||
_delayedKill.add(deadServer.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -653,6 +666,105 @@ public class ServerMonitor
|
||||
killServer(serverToKill.getName(), serverToKill.getPublicAddress(), serverToKill.getPlayerCount(), message, true);
|
||||
}
|
||||
|
||||
private static void startTimingReport(final MinecraftServer server)
|
||||
{
|
||||
if (_debug)
|
||||
return;
|
||||
|
||||
String cmd = "/home/mineplex/remoteStartTiming.sh";
|
||||
|
||||
ProcessRunner pr = new ProcessRunner(new String[] {"/bin/sh", cmd, server.getPublicAddress(), server.getName() });
|
||||
pr.start(new GenericRunnable<Boolean>()
|
||||
{
|
||||
public void run(Boolean error)
|
||||
{
|
||||
if (error)
|
||||
log("[TIMING START] Errored " + server.getName() + "(" + server.getPublicAddress() + ")");
|
||||
else
|
||||
log("[TIMING START] Succeeded " + server.getName() + "(" + server.getPublicAddress() + ")");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
pr.join(100);
|
||||
}
|
||||
catch (InterruptedException e1)
|
||||
{
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
if (!pr.isDone())
|
||||
_processes.add(pr);
|
||||
}
|
||||
|
||||
private static void stopTimingReport(final MinecraftServer server)
|
||||
{
|
||||
if (_debug)
|
||||
return;
|
||||
|
||||
String cmd = "/home/mineplex/remoteStopTiming.sh";
|
||||
|
||||
ProcessRunner pr = new ProcessRunner(new String[] {"/bin/sh", cmd, server.getPublicAddress(), server.getName() });
|
||||
pr.start(new GenericRunnable<Boolean>()
|
||||
{
|
||||
public void run(Boolean error)
|
||||
{
|
||||
if (error)
|
||||
log("[TIMING PASTE] Errored " + server.getName() + "(" + server.getPublicAddress() + ")");
|
||||
else
|
||||
log("[TIMING PASTE] Succeeded " + server.getName() + "(" + server.getPublicAddress() + ")");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
pr.join(100);
|
||||
}
|
||||
catch (InterruptedException e1)
|
||||
{
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
if (!pr.isDone())
|
||||
_processes.add(pr);
|
||||
}
|
||||
|
||||
private static void copyServerLog(final MinecraftServer server)
|
||||
{
|
||||
if (_debug)
|
||||
return;
|
||||
|
||||
String cmd = "/home/mineplex/easyRemoteCopyLog.sh";
|
||||
|
||||
ProcessRunner pr = new ProcessRunner(new String[] {"/bin/sh", cmd, server.getPublicAddress(), server.getName() });
|
||||
pr.start(new GenericRunnable<Boolean>()
|
||||
{
|
||||
public void run(Boolean error)
|
||||
{
|
||||
if (error)
|
||||
log("[COPY LOG] Errored " + server.getName() + "(" + server.getPublicAddress() + ")");
|
||||
else
|
||||
log("[COPY LOG] Succeeded " + server.getName() + "(" + server.getPublicAddress() + ")");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
pr.join(100);
|
||||
}
|
||||
catch (InterruptedException e1)
|
||||
{
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
if (!pr.isDone())
|
||||
_processes.add(pr);
|
||||
}
|
||||
|
||||
private static void startServer(final DedicatedServer serverSpace, final ServerGroup serverGroup, final int serverNum, final boolean free)
|
||||
{
|
||||
if (_debug)
|
||||
|
Loading…
Reference in New Issue
Block a user