mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 02:08:27 +01:00
Don't store temporary servers in servers.yml
This commit is contained in:
parent
08b56fc823
commit
ea9eec9aa8
@ -14,6 +14,7 @@ import net.ME1312.SubData.Server.SubDataClient;
|
||||
import net.ME1312.SubServers.Bungee.Event.SubCreateEvent;
|
||||
import net.ME1312.SubServers.Bungee.Event.SubCreatedEvent;
|
||||
import net.ME1312.SubServers.Bungee.Host.*;
|
||||
import net.ME1312.SubServers.Bungee.Host.SubServer.StopAction;
|
||||
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
|
||||
import net.ME1312.SubServers.Bungee.Network.Packet.PacketExConfigureHost;
|
||||
import net.ME1312.SubServers.Bungee.Network.Packet.PacketExCreateServer;
|
||||
@ -212,8 +213,11 @@ public class ExternalSubCreator extends SubCreator {
|
||||
if (action != null) subserver.setStopAction(action);
|
||||
if (server.contains("Extra")) for (String extra : server.getMap("Extra").getKeys())
|
||||
subserver.addExtra(extra, server.getMap("Extra").getObject(extra));
|
||||
host.plugin.servers.get().getMap("Servers").set(name, server);
|
||||
host.plugin.servers.save();
|
||||
|
||||
if (!(subserver.getStopAction() == StopAction.REMOVE_SERVER || subserver.getStopAction() == StopAction.RECYCLE_SERVER || subserver.getStopAction() == StopAction.DELETE_SERVER)) {
|
||||
host.plugin.servers.get().getMap("Servers").set(name, server);
|
||||
host.plugin.servers.save();
|
||||
}
|
||||
|
||||
if (update == null && template.getBuildOptions().getBoolean("Run-On-Finish", true))
|
||||
subserver.start();
|
||||
|
@ -15,6 +15,7 @@ import net.ME1312.Galaxi.Library.Version.Version;
|
||||
import net.ME1312.SubServers.Bungee.Event.SubCreateEvent;
|
||||
import net.ME1312.SubServers.Bungee.Event.SubCreatedEvent;
|
||||
import net.ME1312.SubServers.Bungee.Host.*;
|
||||
import net.ME1312.SubServers.Bungee.Host.SubServer.StopAction;
|
||||
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
|
||||
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidServerException;
|
||||
import net.ME1312.SubServers.Bungee.Library.Exception.SubCreatorException;
|
||||
@ -311,8 +312,11 @@ public class InternalSubCreator extends SubCreator {
|
||||
if (action != null) subserver.setStopAction(action);
|
||||
if (server.contains("Extra")) for (String extra : server.getMap("Extra").getKeys())
|
||||
subserver.addExtra(extra, server.getMap("Extra").getObject(extra));
|
||||
host.plugin.servers.get().getMap("Servers").set(name, server);
|
||||
host.plugin.servers.save();
|
||||
|
||||
if (!(subserver.getStopAction() == StopAction.REMOVE_SERVER || subserver.getStopAction() == StopAction.RECYCLE_SERVER || subserver.getStopAction() == StopAction.DELETE_SERVER)) {
|
||||
host.plugin.servers.get().getMap("Servers").set(name, server);
|
||||
host.plugin.servers.save();
|
||||
}
|
||||
|
||||
if (update == null && template.getBuildOptions().getBoolean("Run-On-Finish", true))
|
||||
subserver.start();
|
||||
|
@ -44,13 +44,18 @@ public class PacketDownloadPlatformInfo implements PacketObjectIn<Integer>, Pack
|
||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||
if (tracker != null) data.set(0x0000, tracker);
|
||||
ObjectMap<String> info = new ObjectMap<String>();
|
||||
|
||||
|
||||
ObjectMap<String> subservers = new ObjectMap<String>();
|
||||
subservers.set("version", plugin.api.getWrapperVersion().toString());
|
||||
if (plugin.api.getWrapperBuild() != null) subservers.set("build", plugin.api.getWrapperBuild().toString());
|
||||
subservers.set("last-reload", plugin.resetDate);
|
||||
subservers.set("proxies", plugin.api.getProxies().size());
|
||||
subservers.set("hosts", plugin.api.getHosts().size());
|
||||
subservers.set("subservers", plugin.api.getSubServers().size());
|
||||
info.set("subservers", subservers);
|
||||
|
||||
|
||||
ObjectMap<String> bungee = new ObjectMap<String>();
|
||||
bungee.set("version", plugin.api.getProxyVersion().toString());
|
||||
bungee.set("disabled-cmds", plugin.getConfig().getDisabledCommands());
|
||||
@ -67,12 +72,16 @@ public class PacketDownloadPlatformInfo implements PacketObjectIn<Integer>, Pack
|
||||
}
|
||||
bungee.set("listeners", listeners);
|
||||
info.set("bungee", bungee);
|
||||
|
||||
|
||||
ObjectMap<String> minecraft = new ObjectMap<String>();
|
||||
LinkedList<String> mcversions = new LinkedList<String>();
|
||||
for (Version version : plugin.api.getGameVersion()) mcversions.add(version.toString());
|
||||
minecraft.set("version", mcversions);
|
||||
minecraft.set("players", plugin.api.getRemotePlayers().size());
|
||||
info.set("minecraft", minecraft);
|
||||
|
||||
|
||||
ObjectMap<String> system = new ObjectMap<String>();
|
||||
ObjectMap<String> os = new ObjectMap<String>();
|
||||
os.set("name", System.getProperty("os.name"));
|
||||
@ -82,6 +91,8 @@ public class PacketDownloadPlatformInfo implements PacketObjectIn<Integer>, Pack
|
||||
java.set("version", System.getProperty("java.version"));
|
||||
system.set("java", java);
|
||||
info.set("system", system);
|
||||
|
||||
|
||||
data.set(0x0001, info);
|
||||
return data;
|
||||
}
|
||||
|
@ -734,6 +734,23 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
}
|
||||
}
|
||||
}, TimeUnit.SECONDS.toMillis(rpec_s), TimeUnit.SECONDS.toMillis(rpec_i));
|
||||
new Timer("SubServers.Bungee::Garbo_Collector").schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
long start = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
|
||||
System.gc();
|
||||
Timer timer = new Timer("SubServers.Bungee::Garbo_Collector_Result");
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
long end = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
|
||||
Logger.get("SGC").info("Cleared " + (start - end) + " bytes of extremely useless memory data. Now using " + end + " bytes.");
|
||||
if (subdata != null) Logger.get("SDD").info(subdata.getClients().size() + " SubData channels are open.");
|
||||
timer.cancel();
|
||||
}
|
||||
}, TimeUnit.MINUTES.toMillis(1));
|
||||
}
|
||||
}, TimeUnit.HOURS.toMillis(1), TimeUnit.HOURS.toMillis(1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user