Add support for GalaxiBungee

This commit is contained in:
ME1312 2019-05-16 18:36:41 -04:00
parent 463ae054a6
commit b808a62fcb
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
40 changed files with 645 additions and 257 deletions

View File

@ -30,7 +30,7 @@
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiUtil</artifactId>
<version>19w20b</version>
<version>19w20k</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -10,6 +10,7 @@ import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.SubCreator;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.Galaxi.Library.Map.ObjectMap;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidServerException;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.SubData.Server.Protocol.PacketObjectOut;
@ -227,7 +228,7 @@ public class ExternalHost extends Host implements ClientHandler {
getSubServer(server).waitFor();
}
System.out.println("SubServers > Saving...");
Logger.get("SubServers").info("Saving...");
ObjectMap<String> info = (plugin.servers.get().getMap("Servers").getKeys().contains(server))?plugin.servers.get().getMap("Servers").getMap(server).clone():new ObjectMap<String>();
info.set("Name", server);
info.set("Timestamp", Calendar.getInstance().getTime().getTime());
@ -240,13 +241,13 @@ public class ExternalHost extends Host implements ClientHandler {
e.printStackTrace();
}
System.out.println("SubServers > Moving Files...");
Logger.get("SubServers").info("Moving Files...");
queue(new PacketExDeleteServer(server, info, true, data -> {
if (data.getInt(0x0001) == 0 || data.getInt(0x0001) == 1) {
servers.remove(server.toLowerCase());
System.out.println("SubServers > Deleted SubServer: " + server);
Logger.get("SubServers").info("Deleted SubServer: " + server);
} else {
System.out.println("SubServers > Couldn't remove " + server + " from memory. See " + getName() + " console for more details");
Logger.get("SubServers").info("Couldn't remove " + server + " from memory. See " + getName() + " console for more details");
}
}));
return true;
@ -264,7 +265,7 @@ public class ExternalHost extends Host implements ClientHandler {
getSubServer(server).terminate();
}
System.out.println("SubServers > Saving...");
Logger.get("SubServers").info("Saving...");
ObjectMap<String> info = (plugin.servers.get().getMap("Servers").getKeys().contains(server))?plugin.servers.get().getMap("Servers").getMap(server).clone():new ObjectMap<String>();
info.set("Name", server);
info.set("Timestamp", Calendar.getInstance().getTime().getTime());
@ -277,14 +278,14 @@ public class ExternalHost extends Host implements ClientHandler {
e.printStackTrace();
}
System.out.println("SubServers > Moving Files...");
Logger.get("SubServers").info("Moving Files...");
queue(new PacketExDeleteServer(server, info, true, data -> {
if (data.getInt(0x0001) == 0 || data.getInt(0x0001) == 1) {
for (String group : getSubServer(server).getGroups()) getSubServer(server).removeGroup(group);
servers.remove(server.toLowerCase());
System.out.println("SubServers > Deleted SubServer: " + server);
Logger.get("SubServers").info("Deleted SubServer: " + server);
} else {
System.out.println("SubServers > Couldn't remove " + server + " from memory. See " + getName() + " console for more details");
Logger.get("SubServers").info("Couldn't remove " + server + " from memory. See " + getName() + " console for more details");
}
}));
return true;
@ -303,7 +304,7 @@ public class ExternalHost extends Host implements ClientHandler {
getSubServer(server).waitFor();
}
System.out.println("SubServers > Saving...");
Logger.get("SubServers").info("Saving...");
ObjectMap<String> info = (plugin.servers.get().getMap("Servers").getKeys().contains(server))?plugin.servers.get().getMap("Servers").getMap(server).clone():new ObjectMap<String>();
info.set("Name", server);
info.set("Timestamp", Calendar.getInstance().getTime().getTime());
@ -316,13 +317,13 @@ public class ExternalHost extends Host implements ClientHandler {
e.printStackTrace();
}
System.out.println("SubServers > Removing Files...");
Logger.get("SubServers").info("Removing Files...");
queue(new PacketExDeleteServer(server, info, false, data -> {
if (data.getInt(0x0001) == 0 || data.getInt(0x0001) == 1) {
servers.remove(server.toLowerCase());
System.out.println("SubServers > Deleted SubServer: " + server);
Logger.get("SubServers").info("Deleted SubServer: " + server);
} else {
System.out.println("SubServers > Couldn't remove " + server + " from memory. See " + getName() + " console for more details");
Logger.get("SubServers").info("Couldn't remove " + server + " from memory. See " + getName() + " console for more details");
}
}));
return true;
@ -340,7 +341,7 @@ public class ExternalHost extends Host implements ClientHandler {
getSubServer(server).terminate();
}
System.out.println("SubServers > Saving...");
Logger.get("SubServers").info("Saving...");
ObjectMap<String> info = (plugin.servers.get().getMap("Servers").getKeys().contains(server))?plugin.servers.get().getMap("Servers").getMap(server).clone():new ObjectMap<String>();
info.set("Name", server);
info.set("Timestamp", Calendar.getInstance().getTime().getTime());
@ -353,14 +354,14 @@ public class ExternalHost extends Host implements ClientHandler {
e.printStackTrace();
}
System.out.println("SubServers > Removing Files...");
Logger.get("SubServers").info("Removing Files...");
queue(new PacketExDeleteServer(server, info, false, data -> {
if (data.getInt(0x0001) == 0 || data.getInt(0x0001) == 1) {
for (String group : getSubServer(server).getGroups()) getSubServer(server).removeGroup(group);
servers.remove(server.toLowerCase());
System.out.println("SubServers > Deleted SubServer: " + server);
Logger.get("SubServers").info("Deleted SubServer: " + server);
} else {
System.out.println("SubServers > Couldn't remove " + server + " from memory. See " + getName() + " console for more details");
Logger.get("SubServers").info("Couldn't remove " + server + " from memory. See " + getName() + " console for more details");
}
}));
return true;

View File

@ -4,6 +4,7 @@ import net.ME1312.SubServers.Bungee.Host.SubLogFilter;
import net.ME1312.SubServers.Bungee.Host.SubLogger;
import net.ME1312.Galaxi.Library.Container;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.Network.Packet.PacketInExLogMessage;
import net.ME1312.SubServers.Bungee.SubAPI;
import net.md_5.bungee.api.ProxyServer;
@ -113,7 +114,7 @@ public class ExternalSubLogger extends SubLogger {
}
// Log to CONSOLE
if (allow) ProxyServer.getInstance().getLogger().log(level, name + " > " + msg);
if (allow) Logger.get(name).log(level, msg);
// Log to FILE
if (writer != null) {

View File

@ -6,6 +6,7 @@ import net.ME1312.SubServers.Bungee.Host.*;
import net.ME1312.Galaxi.Library.Map.ObjectMap;
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
import net.ME1312.Galaxi.Library.Container;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidServerException;
import net.ME1312.Galaxi.Library.NamedContainer;
import net.ME1312.Galaxi.Library.Util;
@ -77,7 +78,7 @@ public class ExternalSubServer extends SubServerContainer {
host.plugin.getPluginManager().callEvent(event);
lock = false;
if (!event.isCancelled()) {
System.out.println("SubServers > Now starting " + getName());
Logger.get("SubServers").info("Now starting " + getName());
running = true;
logger.start();
host.queue(new PacketExUpdateServer(this, PacketExUpdateServer.UpdateType.START, logger.getExternalAddress().toString()));
@ -86,7 +87,7 @@ public class ExternalSubServer extends SubServerContainer {
} else return false;
}
private void falsestart() {
System.out.println("SubServers > Couldn't start " + getName() + " - See the " + host.getName() + " console for more details");
Logger.get("SubServers").info("Couldn't start " + getName() + " - See the " + host.getName() + " console for more details");
running = false;
logger.stop();
}
@ -106,7 +107,7 @@ public class ExternalSubServer extends SubServerContainer {
private void stopped(Boolean allowrestart) {
SubStoppedEvent event = new SubStoppedEvent(this);
host.plugin.getPluginManager().callEvent(event);
System.out.println("SubServers > " + getName() + " has stopped");
Logger.get("SubServers").info(getName() + " has stopped");
logger.stop();
history.clear();
running = false;

View File

@ -6,6 +6,7 @@ import net.ME1312.Galaxi.Library.Config.YAMLSection;
import net.ME1312.SubServers.Bungee.Event.SubAddServerEvent;
import net.ME1312.SubServers.Bungee.Event.SubRemoveServerEvent;
import net.ME1312.Galaxi.Library.Map.ObjectMap;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.SubCreator;
@ -154,7 +155,7 @@ public class InternalHost extends Host {
UniversalFile to = new UniversalFile(plugin.dir, "SubServers:Recently Deleted:" + server.toLowerCase());
try {
if (from.exists()) {
System.out.println("SubServers > Moving Files...");
Logger.get("SubServers").info("Moving Files...");
if (to.exists()) {
if (to.isDirectory()) Util.deleteDirectory(to);
else to.delete();
@ -167,7 +168,7 @@ public class InternalHost extends Host {
e.printStackTrace();
}
System.out.println("SubServers > Saving...");
Logger.get("SubServers").info("Saving...");
YAMLSection info = (plugin.servers.get().getMap("Servers").getKeys().contains(server))?new YAMLSection(plugin.servers.get().getMap("Servers").getMap(server).get()):new YAMLSection();
info.set("Name", server);
info.set("Timestamp", Calendar.getInstance().getTime().getTime());
@ -183,7 +184,7 @@ public class InternalHost extends Host {
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("SubServers > Deleted SubServer: " + server);
Logger.get("SubServers").info("Deleted SubServer: " + server);
}, "SubServers.Bungee::Internal_Server_Recycler(" + name + ')').start();
return true;
} else return false;
@ -199,7 +200,7 @@ public class InternalHost extends Host {
UniversalFile to = new UniversalFile(plugin.dir, "SubServers:Recently Deleted:" + server.toLowerCase());
try {
if (from.exists()) {
System.out.println("SubServers > Moving Files...");
Logger.get("SubServers").info("Moving Files...");
if (to.exists()) {
if (to.isDirectory()) Util.deleteDirectory(to);
else to.delete();
@ -212,7 +213,7 @@ public class InternalHost extends Host {
e.printStackTrace();
}
System.out.println("SubServers > Saving...");
Logger.get("SubServers").info("Saving...");
YAMLSection info = (plugin.servers.get().getMap("Servers").getKeys().contains(server))?new YAMLSection(plugin.servers.get().getMap("Servers").getMap(server).get()):new YAMLSection();
info.set("Name", server);
info.set("Timestamp", Calendar.getInstance().getTime().getTime());
@ -228,7 +229,7 @@ public class InternalHost extends Host {
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("SubServers > Deleted SubServer: " + server);
Logger.get("SubServers").info("Deleted SubServer: " + server);
}, "SubServers.Bungee::Internal_Server_Recycler(" + name + ')').start();
return true;
} else return false;
@ -243,14 +244,14 @@ public class InternalHost extends Host {
new Thread(() -> {
try {
if (from.exists()) {
System.out.println("SubServers > Removing Files...");
Logger.get("SubServers").info("Removing Files...");
Util.deleteDirectory(from);
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("SubServers > Saving...");
Logger.get("SubServers").info("Saving...");
try {
if (plugin.servers.get().getMap("Servers").getKeys().contains(server)) {
plugin.servers.get().getMap("Servers").remove(server);
@ -259,7 +260,7 @@ public class InternalHost extends Host {
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("SubServers > Deleted SubServer: " + server);
Logger.get("SubServers").info("Deleted SubServer: " + server);
}, "SubServers.Bungee::Internal_Server_Deletion(" + name + ')').start();
return true;
} else return false;
@ -274,14 +275,14 @@ public class InternalHost extends Host {
new Thread(() -> {
try {
if (from.exists()) {
System.out.println("SubServers > Removing Files...");
Logger.get("SubServers").info("Removing Files...");
Util.deleteDirectory(from);
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("SubServers > Saving...");
Logger.get("SubServers").info("Saving...");
try {
if (plugin.servers.get().getMap("Servers").getKeys().contains(server)) {
plugin.servers.get().getMap("Servers").remove(server);
@ -290,7 +291,7 @@ public class InternalHost extends Host {
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("SubServers > Deleted SubServer: " + server);
Logger.get("SubServers").info("Deleted SubServer: " + server);
}, "SubServers.Bungee::Internal_Server_Deletion(" + name + ')').start();
return true;
} else return false;

View File

@ -4,6 +4,7 @@ import net.ME1312.SubServers.Bungee.Host.SubLogFilter;
import net.ME1312.SubServers.Bungee.Host.SubLogger;
import net.ME1312.Galaxi.Library.Container;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.SubAPI;
import net.md_5.bungee.api.ProxyServer;
@ -131,7 +132,7 @@ public class InternalSubLogger extends SubLogger {
}
// Log to CONSOLE
if (allow) ProxyServer.getInstance().getLogger().log(level, name + " > " + msg);
if (allow) Logger.get(name).log(level, msg);
// Log to FILE
if (writer != null) {

View File

@ -5,6 +5,7 @@ import net.ME1312.SubServers.Bungee.Host.*;
import net.ME1312.Galaxi.Library.Map.ObjectMap;
import net.ME1312.Galaxi.Library.Map.ObjectMapValue;
import net.ME1312.Galaxi.Library.Container;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidServerException;
import net.ME1312.Galaxi.Library.NamedContainer;
import net.ME1312.Galaxi.Library.UniversalFile;
@ -125,7 +126,7 @@ public class InternalSubServer extends SubServerContainer {
pb.environment().put("address", host.getAddress().getHostAddress());
pb.environment().put("port", Integer.toString(getAddress().getPort()));
process = pb.start();
System.out.println("SubServers > Now starting " + getName());
Logger.get("SubServers").info("Now starting " + getName());
logger.process = process;
logger.start();
command = new BufferedWriter(new OutputStreamWriter(process.getOutputStream()));
@ -143,7 +144,7 @@ public class InternalSubServer extends SubServerContainer {
SubStoppedEvent event = new SubStoppedEvent(this);
host.plugin.getPluginManager().callEvent(event);
System.out.println("SubServers > " + getName() + " has stopped");
Logger.get("SubServers").info(getName() + " has stopped");
process = null;
command = null;
history.clear();

View File

@ -1,11 +1,15 @@
package net.ME1312.SubServers.Bungee;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.Galaxi.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Library.Compatibility.GalaxiInfo;
import java.security.Security;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.jar.Manifest;
import java.util.logging.Logger;
/**
* SubServers/BungeeCord Launch Class
@ -71,54 +75,65 @@ public final class Launch {
javaarch = System.getProperty("sun.arch.data.model");
}
Version galaxi = GalaxiInfo.getVersion();
Version galaxibuild = GalaxiInfo.getSignature();
System.out.println("");
System.out.println(System.getProperty("os.name") + ((!System.getProperty("os.name").toLowerCase().startsWith("windows"))?' ' + System.getProperty("os.version"):"") + ((osarch != null)?" [" + osarch + ']':"") + ',');
System.out.println("Java " + System.getProperty("java.version") + ((javaarch != null)?" [" + javaarch + ']':"") + ',');
System.out.println("BungeeCord" + ((patched)?" [Patched] ":" ") + net.md_5.bungee.Bootstrap.class.getPackage().getImplementationVersion() + ',');
if (galaxi != null)
System.out.println("GalaxiEngine v" + galaxi.toExtendedString() + ((galaxibuild != null)?" (" + galaxibuild + ')':"") + ',');
System.out.println("BungeeCord" + net.md_5.bungee.Bootstrap.class.getPackage().getImplementationVersion() + ((patched)?" [Patched]":"") + ',');
System.out.println("SubServers.Bungee v" + SubPlugin.version.toExtendedString() + ((SubPlugin.class.getPackage().getSpecificationTitle() != null)?" (" + SubPlugin.class.getPackage().getSpecificationTitle() + ')':""));
System.out.println("");
} else {
System.out.println("");
System.out.println("*******************************************");
System.out.println("*** Warning: this build is unofficial ***");
System.out.println("*** ***");
System.out.println("*** Please report all issues to ME1312, ***");
System.out.println("*** NOT the Spigot Team. Thank You! ***");
System.out.println("*******************************************");
try {
if (net.md_5.bungee.BungeeCord.class.getPackage().getSpecificationVersion() != null) {
Date date = (new SimpleDateFormat("yyyyMMdd")).parse(net.md_5.bungee.BungeeCord.class.getPackage().getSpecificationVersion());
Calendar line = Calendar.getInstance();
line.add(3, -4);
if (date.before(line.getTime())) {
System.out.println("*** Warning: BungeeCord is outdated ***");
System.out.println("*** Please download a new build from: ***");
System.out.println("*** http://ci.md-5.net/job/BungeeCord ***");
System.out.println("*** Errors may arise on older versions! ***");
System.out.println("*******************************************");
}
} else throw new Exception();
} catch (Exception e) {
System.out.println("*** Problem checking BungeeCord version ***");
System.out.println("*** BungeeCord could be outdated. ***");
System.out.println("*** ***");
System.out.println("*** Errors may arise on older versions! ***");
boolean gb;
if (!(gb = !Util.isException(() -> Util.reflect(net.md_5.bungee.log.LoggingOutputStream.class.getMethod("setLogger", Logger.class, String.class), null,
Util.reflect(net.md_5.bungee.log.BungeeLogger.class.getMethod("get", String.class), null, "SubServers"), "net.ME1312.SubServers.Bungee.")))) {
System.out.println("");
System.out.println("*******************************************");
System.out.println("*** Warning: this build is unofficial ***");
System.out.println("*** ***");
System.out.println("*** Please report all issues to ME1312, ***");
System.out.println("*** NOT the Spigot Team. Thank You! ***");
System.out.println("*******************************************");
try {
if (net.md_5.bungee.BungeeCord.class.getPackage().getSpecificationVersion() != null) {
Date date = (new SimpleDateFormat("yyyyMMdd")).parse(net.md_5.bungee.BungeeCord.class.getPackage().getSpecificationVersion());
Calendar line = Calendar.getInstance();
line.add(3, -4);
if (date.before(line.getTime())) {
System.out.println("*** Warning: BungeeCord is outdated ***");
System.out.println("*** Please download a new build from: ***");
System.out.println("*** http://ci.md-5.net/job/BungeeCord ***");
System.out.println("*** Errors may arise on older versions! ***");
System.out.println("*******************************************");
}
} else throw new Exception();
} catch (Exception e) {
System.out.println("*** Problem checking BungeeCord version ***");
System.out.println("*** BungeeCord could be outdated. ***");
System.out.println("*** ***");
System.out.println("*** Errors may arise on older versions! ***");
System.out.println("*******************************************");
}
System.out.println("");
}
System.out.println("");
SubPlugin plugin = new SubPlugin(System.out, patched);
net.md_5.bungee.api.ProxyServer.class.getMethod("setInstance", net.md_5.bungee.api.ProxyServer.class).invoke(null, plugin);
plugin.getLogger().info("Enabled " + plugin.getBungeeName() + " version " + plugin.getVersion());
if (!gb) plugin.getLogger().info("Enabled " + plugin.getBungeeName() + " version " + plugin.getVersion());
plugin.start();
if (!options.has("noconsole")) {
try {
if (Util.getDespiteException(() -> Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole").getMethod("readCommands") != null, false)) {
if (Util.getDespiteException(() -> Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole").getMethod("readCommands") != null, false)) { // Waterfall Setup
Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole").getMethod("readCommands").invoke(null);
} else if (Util.getDespiteException(() -> Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole").getMethod("start") != null, false)) {
Class console = Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole");
console.getMethod("start").invoke(console.getConstructor().newInstance());
} else if (Util.getDespiteException(() -> Class.forName("net.md_5.bungee.util.GalaxiBungeeInfo").getMethod("get").invoke(null).getClass().getCanonicalName().equals("net.ME1312.Galaxi.Plugin.PluginInfo"), false)) {
// GalaxiBungee initializes its console automatically
} else {
plugin.canSudo = true;
String line;
@ -129,7 +144,7 @@ public final class Launch {
}
} else if (line.equalsIgnoreCase("exit")) {
plugin.sudo = null;
System.out.println("SubServers > Reverting to the BungeeCord Console");
net.ME1312.SubServers.Bungee.Library.Compatibility.Logger.get("SubServers").info("Reverting to the BungeeCord Console");
} else {
plugin.sudo.command(line);
}

View File

@ -0,0 +1,47 @@
package net.ME1312.SubServers.Bungee.Library.Compatibility;
import net.ME1312.Galaxi.Library.Util;
import net.md_5.bungee.api.plugin.Command;
/**
* Galaxi Command Compatibility Class
*/
public class GalaxiCommand {
/**
* Set the Description of a Command
*
* @param command Command
* @param value Value
* @return The Command
*/
public static Command description(Command command, String value) {
Util.isException(() -> Util.reflect(Class.forName("net.ME1312.Galaxi.Plugin.Command.Command").getMethod("description", String.class), command, value));
return command;
}
/**
* Set the Help Page for a Command
*
* @param command Command
* @param lines Help Page Lines
* @return The Command
*/
public static Command help(Command command, String... lines) {
Util.isException(() -> Util.reflect(Class.forName("net.ME1312.Galaxi.Plugin.Command.Command").getMethod("help", String[].class), command, (Object) lines));
return command;
}
/**
* Set the Usage of a Command
*
* @param command Command
* @param args Argument Placeholders
* @return The Command
*/
public static Command usage(Command command, String... args) {
Util.isException(() -> Util.reflect(Class.forName("net.ME1312.Galaxi.Plugin.Command.Command").getMethod("usage", String[].class), command, (Object) args));
return command;
}
}

View File

@ -0,0 +1,47 @@
package net.ME1312.SubServers.Bungee.Library.Compatibility;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.Galaxi.Library.Version.Version;
import java.lang.annotation.Annotation;
import java.util.jar.Manifest;
/**
* Galaxi Info Class
*/
public class GalaxiInfo {
private GalaxiInfo() {}
@SuppressWarnings("unchecked")
private static <A extends Annotation> Class<A> asAnnotation(Class<?> clazz) {
return (Class<A>) clazz;
}
/**
* Get the Galaxi Version
*
* @return Galaxi Version
*/
public static Version getVersion() {
return Util.getDespiteException(() -> Version.fromString((String) Class.forName("net.ME1312.Galaxi.Plugin.App").getMethod("version").invoke(
Class.forName("net.ME1312.Galaxi.Engine.GalaxiEngine").getAnnotation(asAnnotation(Class.forName("net.ME1312.Galaxi.Plugin.App"))))), null);
}
/**
* Get the Galaxi Build Signature
*
* @return Galaxi Build Signature
*/
public static Version getSignature() {
try {
Manifest manifest = new Manifest(Class.forName("net.ME1312.Galaxi.Engine.GalaxiEngine").getResourceAsStream("/META-INF/GalaxiEngine.MF"));
if (manifest.getMainAttributes().getValue("Implementation-Version") != null && manifest.getMainAttributes().getValue("Implementation-Version").length() > 0) {
return new Version(manifest.getMainAttributes().getValue("Implementation-Version"));
} else {
return null;
}
} catch (Throwable e) {
return null;
}
}
}

View File

@ -0,0 +1,58 @@
package net.ME1312.SubServers.Bungee.Library.Compatibility;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.SubServers.Bungee.SubAPI;
import net.ME1312.SubServers.Bungee.SubPlugin;
import net.md_5.bungee.api.ProxyServer;
import java.util.HashMap;
import java.util.logging.Handler;
import java.util.logging.LogRecord;
/**
* Logger Compatibility Class
*/
public class Logger {
private static final HashMap<String, java.util.logging.Logger> existing = new HashMap<String, java.util.logging.Logger>();
private static SubPlugin plugin;
/**
* Get a logger
*
* @param prefix Prefix
* @return Logger
*/
@SuppressWarnings("deprecation")
public static java.util.logging.Logger get(String prefix) {
if (!existing.keySet().contains(prefix)) {
java.util.logging.Logger log = Util.getDespiteException(() -> Util.reflect(Class.forName("net.ME1312.Galaxi.Library.Log.Logger").getDeclaredMethod("toPrimitive"),
Util.reflect(Class.forName("net.ME1312.Galaxi.Library.Log.Logger").getConstructor(String.class), prefix)), null);
if (log == null) {
log = java.util.logging.Logger.getAnonymousLogger();
log.setUseParentHandlers(false);
log.addHandler(new Handler() {
private boolean open = true;
@Override
public void publish(LogRecord record) {
if (open)
plugin.getLogger().log(record.getLevel(), prefix + " > " + record.getMessage(), record.getParameters());
}
@Override
public void flush() {
}
@Override
public void close() throws SecurityException {
open = false;
}
});
}
existing.put(prefix, log);
}
return existing.get(prefix);
}
}

View File

@ -4,6 +4,7 @@ import net.ME1312.Galaxi.Library.Config.YAMLConfig;
import net.ME1312.Galaxi.Library.Config.YAMLSection;
import net.ME1312.Galaxi.Library.Map.ObjectMap;
import net.ME1312.Galaxi.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.SubAPI;
import java.io.File;
@ -43,7 +44,7 @@ public class ConfigUpdater {
updated.set("Hosts", hosts);
i++;
System.out.println("SubServers > Created ./SubServers/config.yml");
Logger.get("SubServers").info("Created ./SubServers/config.yml");
} else {
if (was.compareTo(new Version("19w17a")) <= 0) {
if (existing.getMap("Settings", new YAMLSection()).contains("Log-Creator")) for (String name : existing.getMap("Hosts", new YAMLSection()).getKeys())
@ -64,7 +65,7 @@ public class ConfigUpdater {
sc.get().safeSet("Servers", new YAMLSection());
sc.get().getMap("Servers").safeSetAll(existing.getMap("Servers"));
System.out.println("SubServers > Created ./SubServers/servers.yml (using existing data)");
Logger.get("SubServers").info("Created ./SubServers/servers.yml (using existing data)");
sc.save();
}
@ -75,7 +76,7 @@ public class ConfigUpdater {
// i++
//}
if (i > 0) System.out.println("SubServers > Updated ./SubServers/config.yml (" + i + " pass" + ((i != 1)?"es":"") + ")");
if (i > 0) Logger.get("SubServers").info("Updated ./SubServers/config.yml (" + i + " pass" + ((i != 1)?"es":"") + ")");
}
if (i > 0) {
@ -143,7 +144,7 @@ public class ConfigUpdater {
updated.set("Servers", servers);
i++;
System.out.println("SubServers > Created ./SubServers/servers.yml");
Logger.get("SubServers").info("Created ./SubServers/servers.yml");
} else {
if (was.compareTo(new Version("19w17a")) <= 0) {
for (String name : existing.getMap("Servers", new YAMLSection()).getKeys()) {
@ -159,7 +160,7 @@ public class ConfigUpdater {
// i++
//}
if (i > 0) System.out.println("SubServers > Updated ./SubServers/servers.yml (" + i + " pass" + ((i != 1)?"es":"") + ")");
if (i > 0) Logger.get("SubServers").info("Updated ./SubServers/servers.yml (" + i + " pass" + ((i != 1)?"es":"") + ")");
}
if (i > 0) {
@ -217,7 +218,7 @@ public class ConfigUpdater {
if (!existing.contains("Settings") || !existing.getMap("Settings").contains("Version")) {
i++;
System.out.println("SubServers > Created ./SubServers/lang.yml");
Logger.get("SubServers").info("Created ./SubServers/lang.yml");
} else {
if (was.compareTo(new Version("19w17a")) <= 0) {
i++;
@ -226,7 +227,7 @@ public class ConfigUpdater {
// i++
//}
if (i > 0) System.out.println("SubServers > Updated ./SubServers/lang.yml (" + i + " pass" + ((i != 1)?"es":"") + ")");
if (i > 0) Logger.get("SubServers").info("Updated ./SubServers/lang.yml (" + i + " pass" + ((i != 1)?"es":"") + ")");
}
if (i > 0) {

View File

@ -6,6 +6,7 @@ import net.ME1312.Galaxi.Library.Util;
import net.ME1312.SubData.Server.SubDataClient;
import net.ME1312.SubData.Server.Protocol.PacketIn;
import net.ME1312.SubData.Server.Protocol.PacketStreamOut;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.SubPlugin;
import java.io.*;
@ -38,7 +39,7 @@ public class PacketExDownloadTemplates implements PacketIn, PacketStreamOut {
Util.zip(new UniversalFile(plugin.dir, "SubServers:Templates"), stream);
stream.close();
} catch (Exception e) {
System.out.println("SubData > Problem encoding template files for Host: " + host.getName());
Logger.get("SubData").info("Problem encoding template files for Host: " + host.getName());
e.printStackTrace();
}
}

View File

@ -10,6 +10,7 @@ import net.ME1312.SubData.Server.ClientHandler;
import net.ME1312.SubData.Server.Protocol.PacketObjectIn;
import net.ME1312.SubData.Server.Protocol.PacketObjectOut;
import net.ME1312.SubServers.Bungee.Host.ServerContainer;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.SubPlugin;
import java.util.HashMap;
@ -64,7 +65,7 @@ public class PacketLinkExHost implements InitialPacket, PacketObjectIn<Integer>,
HashMap<Integer, SubDataClient> subdata = Util.getDespiteException(() -> Util.reflect(ExternalHost.class.getDeclaredField("subdata"), host), null);
if (!subdata.keySet().contains(channel) || (channel == 0 && subdata.get(0) == null)) {
((ExternalHost) host).setSubData(client, channel);
System.out.println("SubData > " + client.getAddress().toString() + " has been defined as Host: " + host.getName() + ((channel > 0)?" (Sub-"+channel+")":""));
Logger.get("SubData").info(client.getAddress().toString() + " has been defined as Host: " + host.getName() + ((channel > 0)?" (Sub-"+channel+")":""));
client.sendPacket(new PacketLinkExHost(0, null));
setReady(client, true);
} else {

View File

@ -10,6 +10,7 @@ import net.ME1312.SubData.Server.SubDataClient;
import net.ME1312.SubData.Server.Protocol.PacketObjectOut;
import net.ME1312.SubData.Server.Protocol.PacketObjectIn;
import net.ME1312.SubServers.Bungee.Host.ServerContainer;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.SubPlugin;
import java.util.HashMap;
@ -75,7 +76,7 @@ public class PacketLinkProxy implements InitialPacket, PacketObjectIn<Integer>,
if (!subdata.keySet().contains(channel) || (channel == 0 && subdata.get(0) == null)) {
proxy.setSubData(client, channel);
if (isnew) plugin.getPluginManager().callEvent(new SubAddProxyEvent(proxy));
System.out.println("SubData > " + client.getAddress().toString() + " has been defined as Proxy: " + proxy.getName() + ((channel > 0)?" (Sub-"+channel+")":""));
Logger.get("SubData").info(client.getAddress().toString() + " has been defined as Proxy: " + proxy.getName() + ((channel > 0)?" (Sub-"+channel+")":""));
client.sendPacket(new PacketLinkProxy(proxy.getName(), 0, null));
setReady(client, true);
} else {

View File

@ -10,6 +10,7 @@ import net.ME1312.Galaxi.Library.Map.ObjectMap;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.SubData.Server.Protocol.PacketObjectIn;
import net.ME1312.SubData.Server.Protocol.PacketObjectOut;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.SubPlugin;
import java.net.InetSocketAddress;
@ -100,9 +101,9 @@ public class PacketLinkServer implements InitialPacket, PacketObjectIn<Integer>,
HashMap<Integer, SubDataClient> subdata = Util.getDespiteException(() -> Util.reflect(ServerContainer.class.getDeclaredField("subdata"), server), null);
if (!subdata.keySet().contains(channel) || (channel == 0 && subdata.get(0) == null)) {
server.setSubData(client, channel);
System.out.println("SubData > " + client.getAddress().toString() + " has been defined as " + ((server instanceof SubServer) ? "SubServer" : "Server") + ": " + server.getName() + ((channel > 0)?" (Sub-"+channel+")":""));
Logger.get("SubData").info(client.getAddress().toString() + " has been defined as " + ((server instanceof SubServer) ? "SubServer" : "Server") + ": " + server.getName() + ((channel > 0)?" (Sub-"+channel+")":""));
if (server instanceof SubServer && !((SubServer) server).isRunning()) {
System.out.println("SubServers > Sending shutdown signal to rogue SubServer: " + server.getName());
Logger.get("SubServers").info("Sending shutdown signal to rogue SubServer: " + server.getName());
client.sendPacket(new PacketOutExReset("Rogue SubServer Detected"));
} else {
client.sendPacket(new PacketLinkServer(server.getName(), 0, null));

View File

@ -25,28 +25,8 @@ public class SubProtocol extends SubDataProtocol {
@SuppressWarnings("deprecation")
public static SubProtocol get() {
if (instance == null) {
log = Logger.getAnonymousLogger();
log.setUseParentHandlers(false);
log.addHandler(new Handler() {
private boolean open = true;
@Override
public void publish(LogRecord record) {
if (open)
ProxyServer.getInstance().getLogger().log(record.getLevel(), "SubData > " + record.getMessage(), record.getParameters());
}
@Override
public void flush() {
}
@Override
public void close() throws SecurityException {
open = false;
}
});
instance = new SubProtocol();
log = net.ME1312.SubServers.Bungee.Library.Compatibility.Logger.get("SubData");
SubPlugin plugin = SubAPI.getInstance().getInternals();
plugin.getPluginManager().registerListener(null, new PacketOutExRunEvent(plugin));

View File

@ -9,6 +9,8 @@ import net.ME1312.Galaxi.Library.NamedContainer;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.Galaxi.Library.Version.Version;
import net.ME1312.SubData.Server.ClientHandler;
import net.ME1312.SubServers.Bungee.Library.Compatibility.GalaxiInfo;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.Network.Packet.PacketExCheckPermission;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
@ -28,6 +30,8 @@ import java.nio.charset.Charset;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static net.ME1312.SubServers.Bungee.Library.Compatibility.GalaxiCommand.*;
/**
* Plugin Command Class
*/
@ -51,6 +55,15 @@ public final class SubCommand extends CommandX {
super(command);
this.plugin = plugin;
this.label = '/' + command;
description(this, "The SubServers Command");
help(this,
"The command for accessing the SubServers Server Manager.",
"",
"Permission: subservers.command",
"Extended help entries:",
" /sub help"
);
}
/**
@ -93,10 +106,15 @@ public final class SubCommand extends CommandX {
javaarch = System.getProperty("sun.arch.data.model");
}
Version galaxi = GalaxiInfo.getVersion();
Version galaxibuild = GalaxiInfo.getSignature();
sender.sendMessage("SubServers > These are the platforms and versions that are running SubServers.Bungee:");
sender.sendMessage(" " + System.getProperty("os.name") + ((!System.getProperty("os.name").toLowerCase().startsWith("windows"))?' ' + System.getProperty("os.version"):"") + ((osarch != null)?" [" + osarch + ']':"") + ',');
sender.sendMessage(" Java " + System.getProperty("java.version") + ((javaarch != null)?" [" + javaarch + ']':"") + ',');
sender.sendMessage(" " + plugin.getBungeeName() + ((plugin.isPatched)?" [Patched] ":" ") + net.md_5.bungee.Bootstrap.class.getPackage().getImplementationVersion() + ',');
if (galaxi != null)
Util.isException(() -> sender.sendMessage(" GalaxiEngine v" + galaxi.toExtendedString() + ((galaxibuild != null)?" (" + galaxibuild + ')':"") + ','));
sender.sendMessage(" " + plugin.getBungeeName() + ((plugin.isGalaxi)?" v":" ") + plugin.getVersion() + ((plugin.isPatched)?" [Patched]":"") + ',');
sender.sendMessage(" SubServers.Bungee v" + SubPlugin.version.toExtendedString() + ((plugin.api.getWrapperBuild() != null)?" (" + plugin.api.getWrapperBuild() + ')':""));
sender.sendMessage("");
new Thread(() -> {
@ -547,7 +565,7 @@ public final class SubCommand extends CommandX {
sender.sendMessage("SubServers > That SubServer is not running");
} else {
plugin.sudo = (SubServer) servers.get(args[1].toLowerCase());
System.out.println("SubServers > Now forwarding commands to " + plugin.sudo.getDisplayName() + ". Type \"exit\" to return.");
Logger.get("SubServers").info("Now forwarding commands to " + plugin.sudo.getDisplayName() + ". Type \"exit\" to return.");
}
} else {
sender.sendMessage("SubServers > Usage: " + label + " " + args[0].toLowerCase() + " <SubServer>");
@ -590,7 +608,7 @@ public final class SubCommand extends CommandX {
} else if (((SubServer) servers.get(args[1].toLowerCase())).isRunning()) {
sender.sendMessage("SubServers > That SubServer is still running");
} else if (!((SubServer) servers.get(args[1].toLowerCase())).getHost().recycleSubServer(args[1].toLowerCase())){
System.out.println("SubServers > Couldn't remove server from memory.");
Logger.get("SubServers").info("Couldn't remove server from memory.");
}
} catch (Exception e) {
e.printStackTrace();
@ -900,6 +918,16 @@ public final class SubCommand extends CommandX {
private BungeeServer(SubPlugin plugin, String command) {
super(command, "bungeecord.command.server");
this.plugin = plugin;
description(this, "Displays a list of or connects you to servers");
help(this,
"Displays a list of all players connected to BungeeCord.",
"This list is separated into groups by server.",
"",
"Permission: bungeecord.command.list",
"Example:",
" /glist"
);
}
protected static NamedContainer<BungeeServer, CommandX> newInstance(SubPlugin plugin, String command) {
@ -993,6 +1021,16 @@ public final class SubCommand extends CommandX {
protected BungeeList(SubPlugin plugin, String command) {
super(command, "bungeecord.command.list");
this.plugin = plugin;
description(this, "Displays a list of all players");
help(this,
"Displays a list of all players connected to BungeeCord.",
"This list is separated into groups by server.",
"",
"Permission: bungeecord.command.list",
"Example:",
" /glist"
);
}
/**

View File

@ -15,6 +15,7 @@ import net.ME1312.SubServers.Bungee.Host.*;
import net.ME1312.SubServers.Bungee.Library.*;
import net.ME1312.Galaxi.Library.Config.YAMLConfig;
import net.ME1312.Galaxi.Library.Config.YAMLSection;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.Library.Fallback.SmartReconnectHandler;
import net.ME1312.SubServers.Bungee.Library.Updates.ConfigUpdater;
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidHostException;
@ -77,15 +78,22 @@ public final class SubPlugin extends BungeeCord implements Listener {
public Proxy redis = null;
public boolean canSudo = false;
public final boolean isPatched;
public final boolean isGalaxi;
public long resetDate = 0;
private boolean running = false;
private boolean posted = false;
private static BigInteger lastSignature = BigInteger.valueOf(-1);
@SuppressWarnings("unchecked")
protected SubPlugin(PrintStream out, boolean isPatched) throws IOException {
protected SubPlugin(PrintStream out, boolean isPatched) throws Exception {
this.isPatched = isPatched;
System.out.println("SubServers > Loading SubServers.Bungee v" + version.toString() + " Libraries (for Minecraft " + api.getGameVersion()[api.getGameVersion().length - 1] + ")");
this.isGalaxi = !Util.isException(() ->
Util.reflect(Class.forName("net.ME1312.Galaxi.Engine.PluginManager").getMethod("findClasses", Class.class),
Util.reflect(Class.forName("net.ME1312.Galaxi.Engine.GalaxiEngine").getMethod("getPluginManager"),
Util.reflect(Class.forName("net.ME1312.Galaxi.Engine.GalaxiEngine").getMethod("getInstance"), null)), Launch.class));
Util.reflect(Logger.class.getDeclaredField("plugin"), null, this);
Logger.get("SubServers").info("Loading SubServers.Bungee v" + version.toString() + " Libraries (for Minecraft " + api.getGameVersion()[api.getGameVersion().length - 1] + ")");
this.out = out;
if (!(new UniversalFile(dir, "config.yml").exists())) {
@ -93,7 +101,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
YAMLConfig tmp = new YAMLConfig(new UniversalFile("config.yml"));
tmp.get().set("stats", UUID.randomUUID().toString());
tmp.save();
System.out.println("SubServers > Created ./config.yml");
Logger.get("SubServers").info("Created ./config.yml");
}
bungee = new YAMLConfig(new UniversalFile(dir, "config.yml"));
@ -113,36 +121,36 @@ public final class SubPlugin extends BungeeCord implements Listener {
new UniversalFile(dir, "Templates").mkdirs();
Util.unzip(SubPlugin.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/vanilla.zip"), new UniversalFile(dir, "Templates"));
System.out.println("SubServers > Created ./SubServers/Templates/Vanilla");
Logger.get("SubServers").info("Created ./SubServers/Templates/Vanilla");
Util.unzip(SubPlugin.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/spigot.zip"), new UniversalFile(dir, "Templates"));
System.out.println("SubServers > Created ./SubServers/Templates/Spigot");
Logger.get("SubServers").info("Created ./SubServers/Templates/Spigot");
Util.unzip(SubPlugin.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/forge.zip"), new UniversalFile(dir, "Templates"));
System.out.println("SubServers > Created ./SubServers/Templates/Forge");
Logger.get("SubServers").info("Created ./SubServers/Templates/Forge");
Util.unzip(SubPlugin.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/sponge.zip"), new UniversalFile(dir, "Templates"));
System.out.println("SubServers > Created ./SubServers/Templates/Sponge");
Logger.get("SubServers").info("Created ./SubServers/Templates/Sponge");
} else {
if (new UniversalFile(dir, "Templates:Vanilla:template.yml").exists() && ((new YAMLConfig(new UniversalFile(dir, "Templates:Vanilla:template.yml"))).get().getVersion("Version", new Version(0))).compareTo(new Version("2.13.2c+")) != 0) {
Files.move(new UniversalFile(dir, "Templates:Vanilla").toPath(), new UniversalFile(dir, "Templates:Vanilla.old" + Math.round(Math.random() * 100000) + ".x").toPath());
Util.unzip(SubPlugin.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/vanilla.zip"), new UniversalFile(dir, "Templates"));
System.out.println("SubServers > Updated ./SubServers/Templates/Vanilla");
Logger.get("SubServers").info("Updated ./SubServers/Templates/Vanilla");
}
if (new UniversalFile(dir, "Templates:Spigot:template.yml").exists() && ((new YAMLConfig(new UniversalFile(dir, "Templates:Spigot:template.yml"))).get().getVersion("Version", new Version(0))).compareTo(new Version("2.13.2c+")) != 0) {
Files.move(new UniversalFile(dir, "Templates:Spigot").toPath(), new UniversalFile(dir, "Templates:Spigot.old" + Math.round(Math.random() * 100000) + ".x").toPath());
Util.unzip(SubPlugin.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/spigot.zip"), new UniversalFile(dir, "Templates"));
System.out.println("SubServers > Updated ./SubServers/Templates/Spigot");
Logger.get("SubServers").info("Updated ./SubServers/Templates/Spigot");
}
if (new UniversalFile(dir, "Templates:Forge:template.yml").exists() && ((new YAMLConfig(new UniversalFile(dir, "Templates:Forge:template.yml"))).get().getVersion("Version", new Version(0))).compareTo(new Version("2.13.2c+")) != 0) {
Files.move(new UniversalFile(dir, "Templates:Forge").toPath(), new UniversalFile(dir, "Templates:Forge.old" + Math.round(Math.random() * 100000) + ".x").toPath());
Util.unzip(SubPlugin.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/forge.zip"), new UniversalFile(dir, "Templates"));
System.out.println("SubServers > Updated ./SubServers/Templates/Forge");
Logger.get("SubServers").info("Updated ./SubServers/Templates/Forge");
}
if (new UniversalFile(dir, "Templates:Sponge:template.yml").exists() && ((new YAMLConfig(new UniversalFile(dir, "Templates:Sponge:template.yml"))).get().getVersion("Version", new Version(0))).compareTo(new Version("2.13.2c+")) != 0) {
Files.move(new UniversalFile(dir, "Templates:Sponge").toPath(), new UniversalFile(dir, "Templates:Sponge.old" + Math.round(Math.random() * 100000) + ".x").toPath());
Util.unzip(SubPlugin.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/sponge.zip"), new UniversalFile(dir, "Templates"));
System.out.println("SubServers > Updated ./SubServers/Templates/Sponge");
Logger.get("SubServers").info("Updated ./SubServers/Templates/Sponge");
}
}
@ -161,25 +169,25 @@ public final class SubPlugin extends BungeeCord implements Listener {
if (TimeUnit.MILLISECONDS.toDays(Calendar.getInstance().getTime().getTime() - info.getLong("Timestamp")) >= 7) {
Util.deleteDirectory(file);
f--;
System.out.println("SubServers > Removed ./SubServers/Recently Deleted/" + file.getName());
Logger.get("SubServers").info("Removed ./SubServers/Recently Deleted/" + file.getName());
}
} else {
Util.deleteDirectory(file);
f--;
System.out.println("SubServers > Removed ./SubServers/Recently Deleted/" + file.getName());
Logger.get("SubServers").info("Removed ./SubServers/Recently Deleted/" + file.getName());
}
} else {
Util.deleteDirectory(file);
f--;
System.out.println("SubServers > Removed ./SubServers/Recently Deleted/" + file.getName());
Logger.get("SubServers").info("Removed ./SubServers/Recently Deleted/" + file.getName());
}
} else {
Files.delete(file.toPath());
f--;
System.out.println("SubServers > Removed ./SubServers/Recently Deleted/" + file.getName());
Logger.get("SubServers").info("Removed ./SubServers/Recently Deleted/" + file.getName());
}
} catch (Exception e) {
System.out.println("SubServers > Problem scanning .SubServers/Recently Deleted/" + file.getName());
Logger.get("SubServers").info("Problem scanning .SubServers/Recently Deleted/" + file.getName());
e.printStackTrace();
Files.delete(file.toPath());
}
@ -205,7 +213,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
getPluginManager().registerListener(null, this);
System.out.println("SubServers > Pre-Parsing Config...");
Logger.get("SubServers").info("Pre-Parsing Config...");
for (String name : servers.get().getMap("Servers").getKeys()) {
try {
if (Util.getCaseInsensitively(config.get().getMap("Hosts").get(), servers.get().getMap("Servers").getMap(name).getString("Host")) == null) throw new InvalidServerException("There is no host with this name: " + servers.get().getMap("Servers").getMap(name).getString("Host"));
@ -217,7 +225,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
}
subprotocol = SubProtocol.get();
System.out.println("SubServers > Loading BungeeCord Libraries...");
Logger.get("SubServers").info("Loading BungeeCord Libraries...");
}
/**
@ -303,22 +311,22 @@ public final class SubPlugin extends BungeeCord implements Listener {
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
System.out.println("SubData > Encrypting SubData with AES:");
System.out.println("SubData > Use the password in config.yml to allow clients to connect");
Logger.get("SubData").info("Encrypting SubData with AES:");
Logger.get("SubData").info("Use the password in config.yml to allow clients to connect");
} else if (ciphers[0].equals("RSA") || ciphers[0].equals("RSA-2048") || ciphers[0].equals("RSA-3072") || ciphers[0].equals("RSA-4096")) {
try {
int length = (ciphers[0].contains("-"))?Integer.parseInt(ciphers[0].split("-")[1]):2048;
subprotocol.registerCipher("RSA", new RSA(length, new UniversalFile("SubServers:Cache:private.rsa.key"), new UniversalFile("SubServers:subdata.rsa.key")));
cipher = "RSA" + cipher.substring(ciphers[0].length());
System.out.println("SubData > Encrypting SubData with RSA:");
System.out.println("SubData > Copy your subdata.rsa.key to clients to allow them to connect");
Logger.get("SubData").info("Encrypting SubData with RSA:");
Logger.get("SubData").info("Copy your subdata.rsa.key to clients to allow them to connect");
} catch (Exception e) {
e.printStackTrace();
}
}
System.out.println("SubData > ");
Logger.get("SubData").info("");
subdata = subprotocol.open((config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0].equals("0.0.0.0"))?null:InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]),
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1]), cipher);
} // Add new entries to Allowed-Connections
@ -338,7 +346,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
if (!redis.getDisplayName().equals("(master)")) redis.setDisplayName("(master)");
for (String name : (List<String>) redis("getAllServers")) {
if (!ukeys.contains(name.toLowerCase()) && !master.equals(name)) try {
if (first) System.out.println("SubServers > "+((status)?"Rel":"L")+"oading Proxies...");
if (first) Logger.get("SubServers").info(((status)?"Rel":"L")+"oading Proxies...");
first = false;
Proxy proxy = this.proxies.get(name.toLowerCase());
if (proxy == null) {
@ -359,7 +367,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
ukeys.clear();
int hosts = 0;
System.out.println("SubServers > "+((status)?"Rel":"L")+"oading Hosts...");
Logger.get("SubServers").info(((status)?"Rel":"L")+"oading Hosts...");
for (String name : config.get().getMap("Hosts").getKeys()) {
if (!ukeys.contains(name.toLowerCase())) try {
if (!hostDrivers.keySet().contains(config.get().getMap("Hosts").getMap(name).getRawString("Driver").toUpperCase().replace('-', '_').replace(' ', '_'))) throw new InvalidHostException("Invalid Driver for host: " + name);
@ -396,7 +404,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
ukeys.clear();
int servers = 0;
System.out.println("SubServers > "+((status)?"Rel":"L")+"oading Servers...");
Logger.get("SubServers").info(((status)?"Rel":"L")+"oading Servers...");
bungee.reload();
for (String name : bungee.get().getMap("servers").getKeys()) {
if (!ukeys.contains(name.toLowerCase())) try {
@ -437,10 +445,10 @@ public final class SubPlugin extends BungeeCord implements Listener {
ukeys.clear();
int subservers = 0;
System.out.println("SubServers > "+((status)?"Rel":"L")+"oading SubServers...");
Logger.get("SubServers").info(((status)?"Rel":"L")+"oading SubServers...");
if (!posted) Runtime.getRuntime().addShutdownHook(new Thread(() -> {
if (running) {
System.out.println("SubServers > Received request from system to shutdown");
Logger.get("SubServers").info("Received request from system to shutdown");
try {
shutdown();
} catch (Exception e) {
@ -552,7 +560,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
int plugins = 0;
List<Runnable> listeners = (status)?api.reloadListeners:api.enableListeners;
if (listeners.size() > 0) {
System.out.println("SubServers > "+((status)?"Rel":"L")+"oading SubAPI Plugins...");
Logger.get("SubServers").info(((status)?"Rel":"L")+"oading SubAPI Plugins...");
for (Runnable obj : listeners) {
try {
obj.run();
@ -568,7 +576,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
for (Server server : api.getServers().values()) if (server.getSubData()[0] != null) ((SubDataClient) server.getSubData()[0]).sendPacket(new PacketOutExReload(null));
}
System.out.println("SubServers > " + ((plugins > 0)?plugins+" Plugin"+((plugins == 1)?"":"s")+", ":"") + ((proxies > 1)?proxies+" Proxies, ":"") + hosts + " Host"+((hosts == 1)?"":"s")+", " + servers + " Server"+((servers == 1)?"":"s")+", and " + subservers + " SubServer"+((subservers == 1)?"":"s")+" "+((status)?"re":"")+"loaded in " + new DecimalFormat("0.000").format((Calendar.getInstance().getTime().getTime() - begin) / 1000D) + "s");
Logger.get("SubServers").info(((plugins > 0)?plugins+" Plugin"+((plugins == 1)?"":"s")+", ":"") + ((proxies > 1)?proxies+" Proxies, ":"") + hosts + " Host"+((hosts == 1)?"":"s")+", " + servers + " Server"+((servers == 1)?"":"s")+", and " + subservers + " SubServer"+((subservers == 1)?"":"s")+" "+((status)?"re":"")+"loaded in " + new DecimalFormat("0.000").format((Calendar.getInstance().getTime().getTime() - begin) / 1000D) + "s");
long scd = TimeUnit.SECONDS.toMillis(this.servers.get().getMap("Settings").getLong("Run-On-Launch-Timeout", 0L));
if (autorun.size() > 0) for (Host host : api.getHosts().values()) {
@ -594,7 +602,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
}
}
if (running && begin == resetDate && Calendar.getInstance().getTime().getTime() - init >= 5000)
System.out.println("SubServers > The auto-start queue for " + host.getName() + " has been finished");
Logger.get("SubServers").info("The auto-start queue for " + host.getName() + " has been finished");
} catch (Exception e) {
e.printStackTrace();
}
@ -633,7 +641,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
updcount++;
}
}
if (updcount > 0) System.out.println("SubServers > SubServers.Bungee v" + updversion + " is available. You are " + updcount + " version" + ((updcount == 1)?"":"s") + " behind.");
if (updcount > 0) Logger.get("SubServers").info("SubServers.Bungee v" + updversion + " is available. You are " + updcount + " version" + ((updcount == 1)?"":"s") + " behind.");
} catch (Exception e) {}
}
}, 0, TimeUnit.DAYS.toMillis(2));
@ -650,7 +658,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
legServers.clear();
legServers.putAll(getServers());
if (api.disableListeners.size() > 0) {
System.out.println("SubServers > Resetting SubAPI Plugins...");
Logger.get("SubServers").info("Resetting SubAPI Plugins...");
for (Runnable listener : api.disableListeners) {
try {
listener.run();
@ -674,7 +682,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
super.stopListeners();
} private void shutdown() throws Exception {
api.ready = false;
System.out.println("SubServers > Resetting Hosts and Server Data");
Logger.get("SubServers").info("Resetting Hosts and Server Data");
List<String> hosts = new ArrayList<String>();
hosts.addAll(this.hosts.keySet());
@ -876,7 +884,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
public void unsudo(SubStoppedEvent e) {
if (sudo == e.getServer()) {
sudo = null;
System.out.println("SubServers > Reverting to the BungeeCord Console");
Logger.get("SubServers").info("Reverting to the BungeeCord Console");
}
}
}

View File

@ -48,7 +48,7 @@
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiUtil</artifactId>
<version>19w20b</version>
<version>19w20k</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -34,8 +34,8 @@ import java.util.concurrent.TimeUnit;
* SubServers Client Plugin Class
*/
public final class SubPlugin extends JavaPlugin {
protected HashMap<Integer, SubDataClient> subdata = new HashMap<Integer, SubDataClient>();
protected NamedContainer<Long, Map<String, Map<String, String>>> lang = null;
HashMap<Integer, SubDataClient> subdata = new HashMap<Integer, SubDataClient>();
NamedContainer<Long, Map<String, Map<String, String>>> lang = null;
public YAMLConfig config;
public SubProtocol subprotocol;

View File

@ -30,7 +30,7 @@
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiUtil</artifactId>
<version>19w20b</version>
<version>19w20k</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -123,6 +123,8 @@
<reportOutputDirectory>${basedir}/../../Javadoc/SubServers.Client.Sponge</reportOutputDirectory>
<additionalOptions>-Xdoclint:none</additionalOptions>
<links>
<link>https://src.me1312.net/jenkins/job/GalaxiEngine/javadoc/GalaxiUtil/</link>
<link>https://src.me1312.net/jenkins/job/SubData/javadoc/Client/</link>
<link>https://jd.spongepowered.org/</link>
</links>
</configuration>

View File

@ -42,8 +42,8 @@ import java.util.concurrent.TimeUnit;
*/
@Plugin(id = "subservers-client-sponge", name = "SubServers-Client-Sponge", authors = "ME1312", version = "2.14a", url = "https://github.com/ME1312/SubServers-2", description = "Access your SubServers from Anywhere")
public final class SubPlugin {
protected HashMap<Integer, SubDataClient> subdata = new HashMap<Integer, SubDataClient>();
protected NamedContainer<Long, Map<String, Map<String, String>>> lang = null;
HashMap<Integer, SubDataClient> subdata = new HashMap<Integer, SubDataClient>();
NamedContainer<Long, Map<String, Map<String, String>>> lang = null;
public YAMLConfig config;
public SubProtocol subprotocol;

View File

@ -3,6 +3,7 @@ package net.ME1312.SubServers.Console;
import net.ME1312.Galaxi.Library.Callback.Callback;
import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command;
@ -37,7 +38,7 @@ public final class ConsoleCommand {
SubServer server = plugin.getProxy().api.getSubServer(name);
if (server != null) {
if (server.isRunning()) {
System.out.println("SubConsole > Opening console window...");
Logger.get("SubConsole").info("Opening console window...");
if (!plugin.sCurrent.keySet().contains(name.toLowerCase())) {
ConsoleWindow window = new ConsoleWindow(plugin, server.getLogger());
plugin.sCurrent.put(name.toLowerCase(), window);
@ -107,7 +108,7 @@ public final class ConsoleCommand {
}
}
} else {
System.out.println("SubConsole > Usage: /" + label + " [host|server] <Name>");
Logger.get("SubConsole").info("Usage: /" + label + " [host|server] <Name>");
}
} else {
String str = label;
@ -204,7 +205,7 @@ public final class ConsoleCommand {
}
}
} else {
System.out.println("SubConsole > Usage: /" + label + " [host|server] <Name>");
Logger.get("SubConsole").info("Usage: /" + label + " [host|server] <Name>");
}
} else {
String str = label;

View File

@ -20,7 +20,7 @@
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiEngine</artifactId>
<version>19w20b</version>
<version>19w20k</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -122,6 +122,7 @@
<additionalOptions>-Xdoclint:none</additionalOptions>
<links>
<link>https://src.me1312.net/jenkins/job/GalaxiEngine/javadoc/GalaxiEngine/</link>
<link>https://src.me1312.net/jenkins/job/SubData/javadoc/Client/</link>
</links>
</configuration>
</execution>

View File

@ -14,7 +14,7 @@ import net.ME1312.Galaxi.Library.UniversalFile;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.Galaxi.Library.Version.Version;
import net.ME1312.Galaxi.Library.Version.VersionType;
import net.ME1312.Galaxi.Plugin.Plugin;
import net.ME1312.Galaxi.Plugin.App;
import net.ME1312.Galaxi.Plugin.PluginInfo;
import net.ME1312.SubData.Client.Encryption.AES;
import net.ME1312.SubData.Client.Encryption.RSA;
@ -41,10 +41,10 @@ import java.util.jar.Manifest;
/**
* SubServers.Host Main Class
*/
@Plugin(name = "SubServers.Host", version = "2.14a", authors = "ME1312", description = "Host SubServers from other Machines", website = "https://github.com/ME1312/SubServers-2")
@App(name = "SubServers.Host", version = "2.14a", authors = "ME1312", description = "Host SubServers from other Machines", website = "https://github.com/ME1312/SubServers-2")
public final class ExHost {
protected HashMap<Integer, SubDataClient> subdata = new HashMap<Integer, SubDataClient>();
protected NamedContainer<Long, Map<String, Map<String, String>>> lang = null;
HashMap<Integer, SubDataClient> subdata = new HashMap<Integer, SubDataClient>();
NamedContainer<Long, Map<String, Map<String, String>>> lang = null;
public HashMap<String, SubCreator.ServerTemplate> templates = new HashMap<String, SubCreator.ServerTemplate>();
public HashMap<String, SubServer> servers = new HashMap<String, SubServer>();
public SubCreator creator;
@ -103,8 +103,8 @@ public final class ExHost {
javaarch = System.getProperty("sun.arch.data.model");
}
Version galaxi = Version.fromString(GalaxiEngine.class.getAnnotation(Plugin.class).version());
Version subservers = Version.fromString(ExHost.class.getAnnotation(Plugin.class).version());
Version galaxi = Version.fromString(GalaxiEngine.class.getAnnotation(App.class).version());
Version subservers = Version.fromString(ExHost.class.getAnnotation(App.class).version());
Version galaxibuild = null;
Version subserversbuild = null;
try {
@ -119,9 +119,8 @@ public final class ExHost {
System.out.println("");
System.out.println(System.getProperty("os.name") + ((!System.getProperty("os.name").toLowerCase().startsWith("windows"))?' ' + System.getProperty("os.version"):"") + ((osarch != null)?" [" + osarch + ']':"") + ',');
System.out.println("Java " + System.getProperty("java.version") + ((javaarch != null)?" [" + javaarch + ']':"") + ',');
System.out.println(GalaxiEngine.class.getAnnotation(Plugin.class).name() + " v" + galaxi.toExtendedString() + ((galaxibuild != null)?" (" + galaxibuild + ')':"")
+ ((GalaxiEngine.class.getProtectionDomain().getCodeSource().getLocation().equals(ExHost.class.getProtectionDomain().getCodeSource().getLocation()))?" [Patched]":"") + ',');
System.out.println(ExHost.class.getAnnotation(Plugin.class).name() + " v" + subservers.toExtendedString() + ((subserversbuild != null)?" (" + subserversbuild + ')':""));
System.out.println(GalaxiEngine.class.getAnnotation(App.class).name() + " v" + galaxi.toExtendedString() + ((galaxibuild != null)?" (" + galaxibuild + ')':"") + ',');
System.out.println(ExHost.class.getAnnotation(App.class).name() + " v" + subservers.toExtendedString() + ((subserversbuild != null)?" (" + subserversbuild + ')':""));
System.out.println("");
} else {
new ExHost(options);

View File

@ -42,7 +42,7 @@ public final class SubAPI {
* Gets the SubServers Internals
*
* @deprecated Use SubAPI Methods when available
* @return SubPlugin Internals
* @return ExHost Internals
*/
@Deprecated
public ExHost getInternals() {
@ -50,9 +50,9 @@ public final class SubAPI {
}
/**
* Get the Server Name
* Get the Host Name
*
* @return Server Name
* @return Host Name
*/
public String getName() {
return name;

View File

@ -30,7 +30,7 @@
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiUtil</artifactId>
<version>19w20b</version>
<version>19w20k</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -136,6 +136,8 @@
<reportOutputDirectory>${basedir}/../Javadoc/SubServers.Sync</reportOutputDirectory>
<additionalOptions>-Xdoclint:none</additionalOptions>
<links>
<link>https://src.me1312.net/jenkins/job/GalaxiEngine/javadoc/GalaxiUtil/</link>
<link>https://src.me1312.net/jenkins/job/SubData/javadoc/Client/</link>
<link>https://ci.md-5.net/job/BungeeCord/ws/api/target/apidocs/</link>
</links>
</configuration>

View File

@ -4,12 +4,14 @@ import net.ME1312.Galaxi.Library.Container;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.Galaxi.Library.Version.Version;
import net.ME1312.Galaxi.Library.Version.VersionType;
import net.ME1312.SubServers.Sync.Library.Compatibility.GalaxiInfo;
import java.lang.reflect.Field;
import java.security.Security;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.logging.Logger;
/**
* SubServers/BungeeCord Launch Class
@ -75,54 +77,67 @@ public final class Launch {
javaarch = System.getProperty("sun.arch.data.model");
}
Version galaxi = GalaxiInfo.getVersion();
Version galaxibuild = GalaxiInfo.getSignature();
System.out.println("");
System.out.println(System.getProperty("os.name") + ((!System.getProperty("os.name").toLowerCase().startsWith("windows"))?' ' + System.getProperty("os.version"):"") + ((osarch != null)?" [" + osarch + ']':"") + ',');
System.out.println("Java " + System.getProperty("java.version") + ((javaarch != null)?" [" + javaarch + ']':"") + ',');
System.out.println("BungeeCord" + ((patched)?" [Patched] ":" ") + net.md_5.bungee.Bootstrap.class.getPackage().getImplementationVersion() + ',');
if (galaxi != null)
System.out.println("GalaxiEngine v" + galaxi.toExtendedString() + ((galaxibuild != null)?" (" + galaxibuild + ')':"") + ',');
System.out.println("BungeeCord" + net.md_5.bungee.Bootstrap.class.getPackage().getImplementationVersion() + ((patched)?" [Patched]":"") + ',');
System.out.println("SubServers.Sync v" + SubPlugin.version.toExtendedString() + ((SubPlugin.class.getPackage().getSpecificationTitle() != null)?" (" + SubPlugin.class.getPackage().getSpecificationTitle() + ')':""));
System.out.println("");
} else {
System.out.println("");
System.out.println("*******************************************");
System.out.println("*** Warning: this build is Unofficial ***");
System.out.println("*** ***");
System.out.println("*** Please report all issues to ME1312, ***");
System.out.println("*** NOT the Spigot Team. Thank You! ***");
System.out.println("*******************************************");
try {
if (net.md_5.bungee.BungeeCord.class.getPackage().getSpecificationVersion() != null) {
Date date = (new SimpleDateFormat("yyyyMMdd")).parse(net.md_5.bungee.BungeeCord.class.getPackage().getSpecificationVersion());
Calendar line = Calendar.getInstance();
line.add(3, -4);
if (date.before(line.getTime())) {
System.out.println("*** Warning: BungeeCord is outdated ***");
System.out.println("*** Please download a new build from: ***");
System.out.println("*** http://ci.md-5.net/job/BungeeCord ***");
System.out.println("*** Errors may arise on older versions! ***");
System.out.println("*******************************************");
}
} else throw new Exception();
} catch (Exception e) {
System.out.println("*** Problem checking BungeeCord Version ***");
System.out.println("*** BungeeCord could be outdated. ***");
System.out.println("*** ***");
System.out.println("*** Errors may arise on older versions! ***");
boolean gb;
if (!(gb = !Util.isException(() -> Util.reflect(net.md_5.bungee.log.LoggingOutputStream.class.getMethod("setLogger", Logger.class, String.class), null,
Util.reflect(net.md_5.bungee.log.BungeeLogger.class.getMethod("get", String.class), null, "SubServers"), "net.ME1312.SubServers.Sync.")))) {
System.out.println("");
System.out.println("*******************************************");
System.out.println("*** Warning: this build is Unofficial ***");
System.out.println("*** ***");
System.out.println("*** Please report all issues to ME1312, ***");
System.out.println("*** NOT the Spigot Team. Thank You! ***");
System.out.println("*******************************************");
try {
if (net.md_5.bungee.BungeeCord.class.getPackage().getSpecificationVersion() != null) {
Date date = (new SimpleDateFormat("yyyyMMdd")).parse(net.md_5.bungee.BungeeCord.class.getPackage().getSpecificationVersion());
Calendar line = Calendar.getInstance();
line.add(3, -4);
if (date.before(line.getTime())) {
System.out.println("*** Warning: BungeeCord is outdated ***");
System.out.println("*** Please download a new build from: ***");
System.out.println("*** http://ci.md-5.net/job/BungeeCord ***");
System.out.println("*** Errors may arise on older versions! ***");
System.out.println("*******************************************");
}
} else throw new Exception();
} catch (Exception e) {
System.out.println("*** Problem checking BungeeCord Version ***");
System.out.println("*** BungeeCord could be outdated. ***");
System.out.println("*** ***");
System.out.println("*** Errors may arise on older versions! ***");
System.out.println("*******************************************");
}
System.out.println("");
} else {
}
System.out.println("");
SubPlugin plugin = new SubPlugin(System.out, patched);
net.md_5.bungee.api.ProxyServer.class.getMethod("setInstance", net.md_5.bungee.api.ProxyServer.class).invoke(null, plugin);
plugin.getLogger().info("Enabled " + plugin.getBungeeName() + " version " + plugin.getVersion());
if (!gb) plugin.getLogger().info("Enabled " + plugin.getBungeeName() + " version " + plugin.getVersion());
plugin.start();
if (!options.has("noconsole")) {
try {
if (Util.getDespiteException(() -> Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole") != null, false)) {
if (Util.getDespiteException(() -> Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole").getMethod("readCommands") != null, false)) { // Waterfall Setup
Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole").getMethod("readCommands").invoke(null);
} else if (Util.getDespiteException(() -> Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole").getMethod("start") != null, false)) {
Class console = Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole");
console.getMethod("start").invoke(console.getConstructor().newInstance());
} else if (Util.getDespiteException(() -> Class.forName("net.md_5.bungee.util.GalaxiBungeeInfo").getMethod("get").invoke(null).getClass().getCanonicalName().equals("net.ME1312.Galaxi.Plugin.PluginInfo"), false)) {
// GalaxiBungee initializes its console automatically
} else {
String line;
while (plugin.isRunning && (line = plugin.getConsoleReader().readLine(">")) != null) {

View File

@ -0,0 +1,47 @@
package net.ME1312.SubServers.Sync.Library.Compatibility;
import net.ME1312.Galaxi.Library.Util;
import net.md_5.bungee.api.plugin.Command;
/**
* Galaxi Command Compatibility Class
*/
public class GalaxiCommand {
/**
* Set the Description of a Command
*
* @param command Command
* @param value Value
* @return The Command
*/
public static Command description(Command command, String value) {
Util.isException(() -> Util.reflect(Class.forName("net.ME1312.Galaxi.Plugin.Command.Command").getMethod("description", String.class), command, value));
return command;
}
/**
* Set the Help Page for a Command
*
* @param command Command
* @param lines Help Page Lines
* @return The Command
*/
public static Command help(Command command, String... lines) {
Util.isException(() -> Util.reflect(Class.forName("net.ME1312.Galaxi.Plugin.Command.Command").getMethod("help", String[].class), command, (Object) lines));
return command;
}
/**
* Set the Usage of a Command
*
* @param command Command
* @param args Argument Placeholders
* @return The Command
*/
public static Command usage(Command command, String... args) {
Util.isException(() -> Util.reflect(Class.forName("net.ME1312.Galaxi.Plugin.Command.Command").getMethod("usage", String[].class), command, (Object) args));
return command;
}
}

View File

@ -0,0 +1,47 @@
package net.ME1312.SubServers.Sync.Library.Compatibility;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.Galaxi.Library.Version.Version;
import java.lang.annotation.Annotation;
import java.util.jar.Manifest;
/**
* Galaxi Info Class
*/
public class GalaxiInfo {
private GalaxiInfo() {}
@SuppressWarnings("unchecked")
private static <A extends Annotation> Class<A> asAnnotation(Class<?> clazz) {
return (Class<A>) clazz;
}
/**
* Get the Galaxi Version
*
* @return Galaxi Version
*/
public static Version getVersion() {
return Util.getDespiteException(() -> Version.fromString((String) Class.forName("net.ME1312.Galaxi.Plugin.App").getMethod("version").invoke(
Class.forName("net.ME1312.Galaxi.Engine.GalaxiEngine").getAnnotation(asAnnotation(Class.forName("net.ME1312.Galaxi.Plugin.App"))))), null);
}
/**
* Get the Galaxi Build Signature
*
* @return Galaxi Build Signature
*/
public static Version getSignature() {
try {
Manifest manifest = new Manifest(Class.forName("net.ME1312.Galaxi.Engine.GalaxiEngine").getResourceAsStream("/META-INF/GalaxiEngine.MF"));
if (manifest.getMainAttributes().getValue("Implementation-Version") != null && manifest.getMainAttributes().getValue("Implementation-Version").length() > 0) {
return new Version(manifest.getMainAttributes().getValue("Implementation-Version"));
} else {
return null;
}
} catch (Throwable e) {
return null;
}
}
}

View File

@ -0,0 +1,61 @@
package net.ME1312.SubServers.Sync.Library.Compatibility;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.SubServers.Sync.SubAPI;
import net.ME1312.SubServers.Sync.SubPlugin;
import net.md_5.bungee.api.ProxyServer;
import java.util.HashMap;
import java.util.logging.Handler;
import java.util.logging.LogRecord;
/**
* Logger Compatibility Class
*/
public class Logger {
private static final HashMap<String, java.util.logging.Logger> existing = new HashMap<String, java.util.logging.Logger>();
private static SubPlugin plugin;
/**
* Get a logger
*
* @param prefix Prefix
* @return Logger
*/
@SuppressWarnings("deprecation")
public static java.util.logging.Logger get(String prefix) {
if (!existing.keySet().contains(prefix)) {
SubPlugin plugin = SubAPI.getInstance().getInternals();
java.util.logging.Logger log;
if (plugin.isGalaxi) {
log = Util.getDespiteException(() -> Util.reflect(Class.forName("net.ME1312.Galaxi.Library.Log.Logger").getDeclaredMethod("toPrimitive"),
Util.reflect(Class.forName("net.ME1312.Galaxi.Library.Log.Logger").getConstructor(String.class), prefix)), null);
} else {
log = java.util.logging.Logger.getAnonymousLogger();
log.setUseParentHandlers(false);
log.addHandler(new Handler() {
private boolean open = true;
@Override
public void publish(LogRecord record) {
if (open)
plugin.getLogger().log(record.getLevel(), prefix + " > " + record.getMessage(), record.getParameters());
}
@Override
public void flush() {
}
@Override
public void close() throws SecurityException {
open = false;
}
});
}
existing.put(prefix, log);
}
return existing.get(prefix);
}
}

View File

@ -1,16 +0,0 @@
Settings:
Version: '2.11.2a+'
Override-Bungee-Commands: true
UPnP:
Forward-Proxy: true
SubData:
Address: '127.0.0.1:4391'
Password: 'default'
Encryption: 'AES'
Sync:
Disabled-Commands: false
Forced-Hosts: true
Motd: false
Player-Limit: false
Server-Priorities: true

View File

@ -4,6 +4,7 @@ import net.ME1312.Galaxi.Library.Config.YAMLConfig;
import net.ME1312.Galaxi.Library.Config.YAMLSection;
import net.ME1312.Galaxi.Library.Map.ObjectMap;
import net.ME1312.Galaxi.Library.Version.Version;
import net.ME1312.SubServers.Sync.Library.Compatibility.Logger;
import net.ME1312.SubServers.Sync.SubAPI;
import java.io.File;
@ -36,7 +37,7 @@ public class ConfigUpdater {
if (!existing.contains("Settings") || !existing.getMap("Settings").contains("Version")) {
i++;
System.out.println("SubServers > Created ./SubServers/sync.yml");
Logger.get("SubServers").info("Created ./SubServers/sync.yml");
} else {
if (was.compareTo(new Version("19w17a")) <= 0) {
@ -46,7 +47,7 @@ public class ConfigUpdater {
// i++
//}
if (i > 0) System.out.println("SubServers > Updated ./SubServers/sync.yml (" + i + " pass" + ((i != 1)?"es":"") + ")");
if (i > 0) Logger.get("SubServers").info("Updated ./SubServers/sync.yml (" + i + " pass" + ((i != 1)?"es":"") + ")");
}
if (i > 0) {

View File

@ -6,6 +6,7 @@ import net.ME1312.Galaxi.Library.Util;
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
import net.ME1312.SubData.Client.Protocol.PacketOut;
import net.ME1312.SubData.Client.SubDataClient;
import net.ME1312.SubServers.Sync.Library.Compatibility.Logger;
import net.ME1312.SubServers.Sync.SubPlugin;
import java.util.Calendar;
@ -35,7 +36,7 @@ public class PacketDownloadLang implements PacketObjectIn<Integer>, PacketOut {
public void receive(SubDataClient client, ObjectMap<Integer> data) {
try {
Util.reflect(SubPlugin.class.getDeclaredField("lang"), plugin, new NamedContainer<>(Calendar.getInstance().getTime().getTime(), data.getObject(0x0001)));
System.out.println("SubData > Lang Settings Downloaded");
Logger.get("SubData").info("Lang Settings Downloaded");
} catch (IllegalAccessException | NoSuchFieldException e) {
e.printStackTrace();
}

View File

@ -6,6 +6,7 @@ import net.ME1312.SubData.Client.Protocol.Initial.InitialPacket;
import net.ME1312.SubData.Client.Protocol.PacketObjectIn;
import net.ME1312.SubData.Client.Protocol.PacketObjectOut;
import net.ME1312.SubData.Client.SubDataClient;
import net.ME1312.SubServers.Sync.Library.Compatibility.Logger;
import net.ME1312.SubServers.Sync.SubAPI;
import net.ME1312.SubServers.Sync.SubPlugin;
@ -55,7 +56,7 @@ public class PacketLinkProxy implements InitialPacket, PacketObjectIn<Integer>,
e.printStackTrace();
}
} else {
System.out.println("SubData > Could not link name with proxy" + ((data.contains(0x0002))?": "+data.getRawString(0x0002):'.'));
Logger.get("SubData").info("Could not link name with proxy" + ((data.contains(0x0002))?": "+data.getRawString(0x0002):'.'));
try {
if (data.getInt(0x0001) == 2) {
if (!plugin.config.get().getMap("Settings").getMap("SubData").contains("Name")) {
@ -63,7 +64,7 @@ public class PacketLinkProxy implements InitialPacket, PacketObjectIn<Integer>,
plugin.config.save();
}
if (plugin.config.get().getMap("Settings").getMap("SubData").getRawString("Name").length() <= 0)
System.out.println("SubData > Use the proxy \"Name\" option to override auto-linking");
Logger.get("SubData").info("Use the proxy \"Name\" option to override auto-linking");
}
} catch (Exception e) {}
new IllegalStateException().printStackTrace();

View File

@ -104,30 +104,7 @@ public class SubProtocol extends SubDataProtocol {
}
private Logger getLogger(int channel) {
Logger log = Logger.getAnonymousLogger();
log.setUseParentHandlers(false);
log.addHandler(new Handler() {
private boolean open = true;
private String prefix = "SubData" + ((channel != 0)? "/Sub-"+channel:"");
@Override
public void publish(LogRecord record) {
if (open)
ProxyServer.getInstance().getLogger().log(record.getLevel(), prefix + " > " + record.getMessage(), record.getParameters());
}
@Override
public void flush() {
}
@Override
public void close() throws SecurityException {
open = false;
}
});
return log;
return net.ME1312.SubServers.Sync.Library.Compatibility.Logger.get("SubData" + ((channel != 0)? "/Sub-"+channel:""));
}
@Override
@ -158,7 +135,7 @@ public class SubProtocol extends SubDataProtocol {
subdata.sendPacket(new PacketDownloadLang());
subdata.sendPacket(new PacketDownloadPlatformInfo(platform -> {
if (plugin.lastReload != platform.getMap("subservers").getLong("last-reload")) {
System.out.println("SubServers > Resetting Server Data");
net.ME1312.SubServers.Sync.Library.Compatibility.Logger.get("SubServers").info("Resetting Server Data");
plugin.servers.clear();
plugin.lastReload = platform.getMap("subservers").getLong("last-reload");
}
@ -173,7 +150,7 @@ public class SubProtocol extends SubDataProtocol {
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Disabled-Commands", false)) Util.reflect(Configuration.class.getDeclaredField("disabledCommands"), plugin.getConfig(), platform.getMap("bungee").getRawStringList("disabled-cmds"));
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Player-Limit", false)) Util.reflect(Configuration.class.getDeclaredField("playerLimit"), plugin.getConfig(), platform.getMap("bungee").getInt("player-limit"));
} catch (Exception e) {
System.out.println("SubServers > Problem syncing BungeeCord configuration options");
net.ME1312.SubServers.Sync.Library.Compatibility.Logger.get("SubServers").info("Problem syncing BungeeCord configuration options");
e.printStackTrace();
}
@ -192,7 +169,7 @@ public class SubProtocol extends SubDataProtocol {
int reconnect = plugin.config.get().getMap("Settings").getMap("SubData").getInt("Reconnect", 30);
if (Util.getDespiteException(() -> Util.reflect(SubPlugin.class.getDeclaredField("reconnect"), plugin), false) && reconnect > 0
&& client.name() != DisconnectReason.PROTOCOL_MISMATCH && client.name() != DisconnectReason.ENCRYPTION_MISMATCH) {
System.out.println("SubData > Attempting reconnect in " + reconnect + " seconds");
net.ME1312.SubServers.Sync.Library.Compatibility.Logger.get("SubData").info("Attempting reconnect in " + reconnect + " seconds");
Timer timer = new Timer("SubServers.Sync::SubData_Reconnect_Handler");
timer.scheduleAtFixedRate(new TimerTask() {
@Override
@ -202,7 +179,7 @@ public class SubProtocol extends SubDataProtocol {
timer.cancel();
} catch (InvocationTargetException e) {
if (e.getTargetException() instanceof IOException) {
System.out.println("SubData > Connection was unsuccessful, retrying in " + reconnect + " seconds");
net.ME1312.SubServers.Sync.Library.Compatibility.Logger.get("SubData").info("Connection was unsuccessful, retrying in " + reconnect + " seconds");
} else e.printStackTrace();
} catch (NoSuchMethodException | IllegalAccessException e) {
e.printStackTrace();

View File

@ -67,9 +67,9 @@ public final class SubAPI {
}
/**
* Get the Server Name
* Get the Proxy Name
*
* @return Server Name
* @return Proxy Name
*/
@SuppressWarnings("unchecked")
public String getName() {

View File

@ -9,6 +9,7 @@ import net.ME1312.Galaxi.Library.Container;
import net.ME1312.Galaxi.Library.NamedContainer;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.Galaxi.Library.Version.Version;
import net.ME1312.SubServers.Sync.Library.Compatibility.GalaxiInfo;
import net.ME1312.SubServers.Sync.Network.API.*;
import net.ME1312.SubServers.Sync.Network.Packet.*;
import net.ME1312.SubServers.Sync.Server.ServerContainer;
@ -30,6 +31,8 @@ import java.nio.charset.Charset;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static net.ME1312.SubServers.Sync.Library.Compatibility.GalaxiCommand.*;
@SuppressWarnings("deprecation")
public final class SubCommand extends CommandX {
static HashMap<UUID, HashMap<ServerInfo, NamedContainer<Long, Boolean>>> players = new HashMap<UUID, HashMap<ServerInfo, NamedContainer<Long, Boolean>>>();
@ -54,6 +57,15 @@ public final class SubCommand extends CommandX {
super(command);
this.plugin = plugin;
this.label = '/' + command;
description(this, "The SubServers Command");
help(this,
"The command for accessing the SubServers Server Manager.",
"",
"Permission: subservers.command",
"Extended help entries:",
" /sub help"
);
}
@SuppressWarnings("unchecked")
@ -95,10 +107,15 @@ public final class SubCommand extends CommandX {
javaarch = System.getProperty("sun.arch.data.model");
}
Version galaxi = GalaxiInfo.getVersion();
Version galaxibuild = GalaxiInfo.getSignature();
sender.sendMessage("SubServers > These are the platforms and versions that are running SubServers.Sync:");
sender.sendMessage(" " + System.getProperty("os.name") + ((!System.getProperty("os.name").toLowerCase().startsWith("windows"))?' ' + System.getProperty("os.version"):"") + ((osarch != null)?" [" + osarch + ']':"") + ',');
sender.sendMessage(" Java " + System.getProperty("java.version") + ((javaarch != null)?" [" + javaarch + ']':"") + ',');
sender.sendMessage(" " + plugin.getBungeeName() + ((plugin.isPatched)?" [Patched] ":" ") + net.md_5.bungee.Bootstrap.class.getPackage().getImplementationVersion() + ',');
if (galaxi != null)
Util.isException(() -> sender.sendMessage("GalaxiEngine v" + galaxi.toExtendedString() + ((galaxibuild != null)?" (" + galaxibuild + ')':"") + ','));
sender.sendMessage(" " + plugin.getBungeeName() + ((plugin.isGalaxi)?" v":" ") + plugin.getVersion() + ((plugin.isPatched)?" [Patched]":"") + ',');
sender.sendMessage(" SubServers.Sync v" + SubPlugin.version.toExtendedString() + ((plugin.api.getWrapperBuild() != null)?" (" + plugin.api.getWrapperBuild() + ')':""));
sender.sendMessage("");
new Thread(() -> {
@ -871,6 +888,16 @@ public final class SubCommand extends CommandX {
private BungeeServer(SubPlugin plugin, String command) {
super(command, "bungeecord.command.server");
this.plugin = plugin;
description(this, "Displays a list of or connects you to servers");
help(this,
"Displays a list of all players connected to BungeeCord.",
"This list is separated into groups by server.",
"",
"Permission: bungeecord.command.list",
"Example:",
" /glist"
);
}
protected static NamedContainer<BungeeServer, CommandX> newInstance(SubPlugin plugin, String command) {
@ -965,6 +992,16 @@ public final class SubCommand extends CommandX {
protected BungeeList(SubPlugin plugin, String command) {
super(command, "bungeecord.command.list");
this.plugin = plugin;
description(this, "Displays a list of all players");
help(this,
"Displays a list of all players connected to BungeeCord.",
"This list is separated into groups by server.",
"",
"Permission: bungeecord.command.list",
"Example:",
" /glist"
);
}
/**

View File

@ -7,6 +7,7 @@ import net.ME1312.SubData.Client.Encryption.RSA;
import net.ME1312.SubServers.Sync.Event.*;
import net.ME1312.Galaxi.Library.Config.YAMLConfig;
import net.ME1312.Galaxi.Library.Map.ObjectMap;
import net.ME1312.SubServers.Sync.Library.Compatibility.Logger;
import net.ME1312.SubServers.Sync.Library.Fallback.SmartReconnectHandler;
import net.ME1312.SubServers.Sync.Library.Metrics;
import net.ME1312.Galaxi.Library.NamedContainer;
@ -44,8 +45,8 @@ import java.util.concurrent.TimeUnit;
* Main Plugin Class
*/
public final class SubPlugin extends BungeeCord implements Listener {
protected HashMap<Integer, SubDataClient> subdata = new HashMap<Integer, SubDataClient>();
protected NamedContainer<Long, Map<String, Map<String, String>>> lang = null;
HashMap<Integer, SubDataClient> subdata = new HashMap<Integer, SubDataClient>();
NamedContainer<Long, Map<String, Map<String, String>>> lang = null;
public final Map<String, ServerContainer> servers = new TreeMap<String, ServerContainer>();
private final HashMap<UUID, List<ServerInfo>> fallbackLimbo = new HashMap<UUID, List<ServerInfo>>();
@ -58,13 +59,20 @@ public final class SubPlugin extends BungeeCord implements Listener {
public static final Version version = Version.fromString("2.14a");
public final boolean isPatched;
public final boolean isGalaxi;
public long lastReload = -1;
private boolean reconnect = false;
private boolean posted = false;
protected SubPlugin(PrintStream out, boolean isPatched) throws IOException {
protected SubPlugin(PrintStream out, boolean isPatched) throws Exception {
this.isPatched = isPatched;
System.out.println("SubServers > Loading SubServers.Sync v" + version.toString() + " Libraries (for Minecraft " + api.getGameVersion()[api.getGameVersion().length - 1] + ")");
this.isGalaxi = !Util.isException(() ->
Util.reflect(Class.forName("net.ME1312.Galaxi.Engine.PluginManager").getMethod("findClasses", Class.class),
Util.reflect(Class.forName("net.ME1312.Galaxi.Engine.GalaxiEngine").getMethod("getPluginManager"),
Util.reflect(Class.forName("net.ME1312.Galaxi.Engine.GalaxiEngine").getMethod("getInstance"), null)), Launch.class));
Util.reflect(Logger.class.getDeclaredField("plugin"), null, this);
Logger.get("SubServers").info("Loading SubServers.Sync v" + version.toString() + " Libraries (for Minecraft " + api.getGameVersion()[api.getGameVersion().length - 1] + ")");
this.out = out;
if (!(new UniversalFile(dir, "config.yml").exists())) {
@ -72,7 +80,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
YAMLConfig tmp = new YAMLConfig(new UniversalFile("config.yml"));
tmp.get().set("stats", UUID.randomUUID().toString());
tmp.save();
System.out.println("SubServers > Created ./config.yml");
Logger.get("SubServers").info("Created ./config.yml");
}
UniversalFile dir = new UniversalFile(this.dir, "SubServers");
dir.mkdir();
@ -83,7 +91,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
subprotocol = SubProtocol.get();
getPluginManager().registerListener(null, this);
System.out.println("SubServers > Loading BungeeCord Libraries...");
Logger.get("SubServers").info("Loading BungeeCord Libraries...");
}
/**
@ -109,19 +117,19 @@ public final class SubPlugin extends BungeeCord implements Listener {
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
System.out.println("SubData > AES Encryption Available");
Logger.get("SubData").info("AES Encryption Available");
}
if (new UniversalFile(dir, "SubServers:subdata.rsa.key").exists()) {
try {
subprotocol.registerCipher("RSA", new RSA(new UniversalFile(dir, "SubServers:subdata.rsa.key")));
System.out.println("SubData > RSA Encryption Available");
Logger.get("SubData").info("RSA Encryption Available");
} catch (Exception e) {
e.printStackTrace();
}
}
reconnect = true;
System.out.println("SubData > ");
Logger.get("SubData").info("");
connect();
super.startListeners();
@ -176,7 +184,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
updcount++;
}
}
if (updcount > 0) System.out.println("SubServers > SubServers.Sync v" + updversion + " is available. You are " + updcount + " version" + ((updcount == 1)?"":"s") + " behind.");
if (updcount > 0) Logger.get("SubServers").info("SubServers.Sync v" + updversion + " is available. You are " + updcount + " version" + ((updcount == 1)?"":"s") + " behind.");
} catch (Exception e) {}
}
}, 0, TimeUnit.DAYS.toMillis(2));
@ -249,7 +257,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
@Override
public void stopListeners() {
try {
System.out.println("SubServers > Resetting Server Data");
Logger.get("SubServers").info("Resetting Server Data");
servers.clear();
reconnect = false;
@ -385,11 +393,11 @@ public final class SubPlugin extends BungeeCord implements Listener {
if (server instanceof net.ME1312.SubServers.Sync.Network.API.SubServer) {
servers.put(server.getName().toLowerCase(), new SubServerContainer(server.getSignature(), server.getName(), server.getDisplayName(), server.getAddress(),
getSubDataAsMap(server), server.getMotd(), server.isHidden(), server.isRestricted(), server.getWhitelist(), ((net.ME1312.SubServers.Sync.Network.API.SubServer) server).isRunning()));
System.out.println("SubServers > Added SubServer: " + e.getServer());
Logger.get("SubServers").info("Added SubServer: " + e.getServer());
} else {
servers.put(server.getName().toLowerCase(), new ServerContainer(server.getSignature(), server.getName(), server.getDisplayName(), server.getAddress(),
getSubDataAsMap(server), server.getMotd(), server.isHidden(), server.isRestricted(), server.getWhitelist()));
System.out.println("SubServers > Added Server: " + e.getServer());
Logger.get("SubServers").info("Added Server: " + e.getServer());
}
} else System.out.println("PacketDownloadServerInfo(" + e.getServer() + ") returned with an invalid response");
});
@ -407,7 +415,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
getSubDataAsMap(server), server.getMotd(), server.isHidden(), server.isRestricted(), server.getWhitelist()));
}
System.out.println("SubServers > Added "+((server instanceof net.ME1312.SubServers.Sync.Network.API.SubServer)?"Sub":"")+"Server: " + server.getName());
Logger.get("SubServers").info("Added "+((server instanceof net.ME1312.SubServers.Sync.Network.API.SubServer)?"Sub":"")+"Server: " + server.getName());
return true;
} else {
if (server instanceof net.ME1312.SubServers.Sync.Network.API.SubServer) {
@ -423,7 +431,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
if (!server.getDisplayName().equals(current.getDisplayName()))
current.setDisplayName(server.getDisplayName());
System.out.println("SubServers > Re-added "+((server instanceof net.ME1312.SubServers.Sync.Network.API.SubServer)?"Sub":"")+"Server: " + server.getName());
Logger.get("SubServers").info("Re-added "+((server instanceof net.ME1312.SubServers.Sync.Network.API.SubServer)?"Sub":"")+"Server: " + server.getName());
return false;
}
}
@ -479,6 +487,6 @@ public final class SubPlugin extends BungeeCord implements Listener {
public void remove(SubRemoveServerEvent e) {
if (servers.keySet().contains(e.getServer().toLowerCase()))
servers.remove(e.getServer().toLowerCase());
System.out.println("SubServers > Removed Server: " + e.getServer());
Logger.get("SubServers").info("Removed Server: " + e.getServer());
}
}