Remove some unused internal classes

This commit is contained in:
ME1312 2021-06-12 17:14:31 -04:00
parent b6a66cfb3b
commit de0e9a676d
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
14 changed files with 99 additions and 462 deletions

View File

@ -31,12 +31,6 @@
<version>21w24a</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiEngine</artifactId>
<version>21w24a</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>

View File

@ -1,58 +0,0 @@
package net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi;
import net.ME1312.Galaxi.Library.Util;
import net.md_5.bungee.api.plugin.Command;
/**
* Galaxi Command Compatibility Class
*/
public class GalaxiCommand {
/**
* Group similar Commands
*
* @param commands Command Classes
*/
@SafeVarargs
public static void group(Class<? extends Command>... commands) {
Util.isException(() -> Util.reflect(GalaxiCommandWrapper.class.getDeclaredConstructor(Class[].class), (Object) commands));
}
/**
* 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(() -> Class.forName("net.ME1312.Galaxi.Command.Command").getMethod("description", String.class).invoke(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(() -> Class.forName("net.ME1312.Galaxi.Command.Command").getMethod("help", String[].class).invoke(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(() -> Class.forName("net.ME1312.Galaxi.Command.Command").getMethod("usage", String[].class).invoke(command, (Object) args));
return command;
}
}

View File

@ -1,75 +0,0 @@
package net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi;
import net.ME1312.Galaxi.Galaxi;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.Galaxi.Command.Command;
import net.ME1312.Galaxi.Command.CommandSender;
import net.ME1312.Galaxi.Command.CompletionHandler;
import net.ME1312.Galaxi.Plugin.PluginManager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
class GalaxiCommandWrapper extends Command implements CompletionHandler {
private HashMap<String, Command> forwards = new HashMap<String, Command>();
private Command data;
@SafeVarargs
GalaxiCommandWrapper(Class<? extends Command>... commands) {
super(Galaxi.getInstance().getAppInfo());
Map<String, Command> registered = Util.getDespiteException(() -> Util.reflect(PluginManager.class.getDeclaredField("commands"), Galaxi.getInstance().getPluginManager()), null);
ArrayList<String> tmp = new ArrayList<String>();
tmp.addAll(registered.keySet());
for (String alias : tmp) {
Command command = registered.get(alias);
for (Class<? extends Command> type : commands) {
if (type.isInstance(command)) {
forwards.put(alias, command);
if (data == null) data = command;
registered.remove(alias);
break;
}
}
}
register(forwards.keySet().toArray(new String[0]));
}
@Override
public void command(CommandSender sender, String label, String[] args) {
if (forwards.keySet().contains(label.toLowerCase())) {
forwards.get(label.toLowerCase()).command(sender, label, args);
} else {
throw new IllegalStateException("Command label not recognised in group: " + forwards.keySet());
}
}
@Override
public String[] complete(CommandSender sender, String label, String[] args) {
if (forwards.keySet().contains(label.toLowerCase())) {
Command command = forwards.get(label.toLowerCase());
if (command.autocomplete() != null) {
return command.autocomplete().complete(sender, label, args);
} else return new String[0];
} else {
throw new IllegalStateException("Command label not recognised in group: " + forwards.keySet());
}
}
@Override
public String description() {
return (data == null)?super.description():data.description();
}
@Override
public String[] help() {
return (data == null)?super.help():data.help();
}
@Override
public String[] usage() {
return (data == null)?super.usage():data.usage();
}
}

View File

@ -1,47 +0,0 @@
package net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi;
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.Runtime.Engine").getAnnotation(asAnnotation(Class.forName("net.ME1312.Galaxi.Plugin.App"))))), null);
}
/**
* Get the Galaxi Build Version
*
* @return Galaxi Build Version
*/
public static Version getBuild() {
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

@ -1,6 +1,5 @@
package net.ME1312.SubServers.Bungee.Library.Compatibility;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.SubServers.Bungee.BungeeCommon;
import java.util.HashMap;
@ -21,11 +20,7 @@ public class Logger {
*/
public static java.util.logging.Logger get(String prefix) {
if (!existing.keySet().contains(prefix)) {
java.util.logging.Logger log = Util.getDespiteException(() -> (java.util.logging.Logger) Class.forName("net.ME1312.Galaxi.Log.Logger").getMethod("toPrimitive")
.invoke(Class.forName("net.ME1312.Galaxi.Log.Logger").getConstructor(String.class).newInstance(prefix)), null);
if (log == null) {
log = java.util.logging.Logger.getAnonymousLogger();
java.util.logging.Logger log = java.util.logging.Logger.getAnonymousLogger();
log.setUseParentHandlers(false);
log.addHandler(new Handler() {
@Override
@ -37,7 +32,6 @@ public class Logger {
public void flush() {}
public void close() {}
});
}
existing.put(prefix, log);
}
return existing.get(prefix);

View File

@ -32,12 +32,6 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiEngine</artifactId>
<version>21w24a</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.ME1312.SubServers</groupId>
<artifactId>SubServers.Bungee.Common</artifactId>

View File

@ -2,8 +2,6 @@ package net.ME1312.SubServers.Bungee;
import net.ME1312.Galaxi.Library.Platform;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.Galaxi.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi.GalaxiInfo;
import java.security.Security;
import java.text.SimpleDateFormat;
@ -49,83 +47,73 @@ public final class Launch {
parser.accepts("noconsole");
joptsimple.OptionSet options = parser.parse(args);
if(options.has("version") || options.has("v")) {
Version galaxi = GalaxiInfo.getVersion();
Version galaxibuild = GalaxiInfo.getBuild();
System.out.println("");
System.out.println(Platform.getSystemName() + ' ' + Platform.getSystemVersion() + ((Platform.getSystemBuild() != null)?" (" + Platform.getSystemBuild() + ')':"") + ((!Platform.getSystemArchitecture().equals("unknown"))?" [" + Platform.getSystemArchitecture() + ']':"") + ',');
System.out.println("Java " + Platform.getJavaVersion() + ((!Platform.getJavaArchitecture().equals("unknown"))?" [" + Platform.getJavaArchitecture() + ']':"") + ',');
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" + SubProxy.version.toExtendedString() + ((SubProxy.class.getPackage().getSpecificationTitle() != null)?" (" + SubProxy.class.getPackage().getSpecificationTitle() + ')':""));
System.out.println("");
} else {
boolean gb = Util.getDespiteException(() -> Class.forName("net.md_5.bungee.util.GalaxiBungeeInfo").getMethod("get").getReturnType().equals(Class.forName("net.ME1312.Galaxi.Plugin.PluginInfo")), false);
if (gb) {
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.");
} else {
System.out.println("");
System.out.println("*******************************************");
System.out.println("*** Warning: this build is unofficial ***");
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("*** Please report all issues to ME1312, ***");
System.out.println("*** NOT the Spigot Team. Thank You! ***");
System.out.println("*** Errors may arise on older versions! ***");
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("");
}
SubProxy plugin = new SubProxy(System.out, patched);
net.md_5.bungee.api.ProxyServer.class.getMethod("setInstance", net.md_5.bungee.api.ProxyServer.class).invoke(null, plugin);
if (!gb) plugin.getLogger().info("Enabled " + plugin.getBungeeName() + " version " + plugin.getVersion());
plugin.start();
SubProxy plugin = new SubProxy(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());
plugin.start();
if (!options.has("noconsole")) {
if (!gb) try {
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 {
plugin.canSudo = true;
String line;
while (plugin.isRunning && (line = plugin.getConsoleReader().readLine(">")) != null) {
if (plugin.sudo == null) {
if (!plugin.getPluginManager().dispatchCommand(net.md_5.bungee.command.ConsoleCommandSender.class.cast(net.md_5.bungee.command.ConsoleCommandSender.class.getMethod("getInstance").invoke(null)), line)) {
plugin.getConsole().sendMessage(net.md_5.bungee.api.ChatColor.RED + "Command not found");
}
} else if (line.equalsIgnoreCase("exit")) {
plugin.sudo = null;
net.ME1312.SubServers.Bungee.Library.Compatibility.Logger.get("SubServers").info("Reverting to the BungeeCord Console");
} else {
plugin.sudo.command(line);
if (!options.has("noconsole")) {
try {
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 {
plugin.canSudo = true;
String line;
while (plugin.isRunning && (line = plugin.getConsoleReader().readLine(">")) != null) {
if (plugin.sudo == null) {
if (!plugin.getPluginManager().dispatchCommand(net.md_5.bungee.command.ConsoleCommandSender.class.cast(net.md_5.bungee.command.ConsoleCommandSender.class.getMethod("getInstance").invoke(null)), line)) {
plugin.getConsole().sendMessage(net.md_5.bungee.api.ChatColor.RED + "Command not found");
}
} else if (line.equalsIgnoreCase("exit")) {
plugin.sudo = null;
net.ME1312.SubServers.Bungee.Library.Compatibility.Logger.get("SubServers").info("Reverting to the BungeeCord Console");
} else {
plugin.sudo.command(line);
}
}
} catch (NoSuchMethodError | NoSuchMethodException e) {
plugin.getLogger().warning("Standard BungeeCord console not found; Console commands may now be disabled.");
}
} catch (NoSuchMethodError | NoSuchMethodException e) {
plugin.getLogger().warning("Standard BungeeCord console not found; Console commands may now be disabled.");
}
}
}

View File

@ -1,40 +0,0 @@
package net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi;
import net.ME1312.Galaxi.Event.Engine.ConsoleInputEvent;
import net.ME1312.Galaxi.Galaxi;
import net.ME1312.Galaxi.Event.ListenerOrder;
import net.ME1312.Galaxi.Event.Subscribe;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.SubProxy;
/**
* Galaxi Event Listener Class
*/
public class GalaxiEventListener {
private SubProxy plugin;
/**
* Create & Register a Galaxi Event Listener
*
* @param plugin Plugin
*/
public GalaxiEventListener(SubProxy plugin) throws Throwable {
this.plugin = plugin;
Galaxi.getInstance().getPluginManager().registerListeners(Galaxi.getInstance().getAppInfo(), this);
plugin.canSudo = true;
}
@Subscribe(order = ListenerOrder.FIRST, override = true)
public void sudo(ConsoleInputEvent e) {
if (plugin.sudo != null) {
e.setCancelled(true);
if (e.getInput().equalsIgnoreCase("exit")) {
plugin.sudo = null;
Logger.get("SubServers").info("Reverting to the BungeeCord Console");
} else {
plugin.sudo.command(e.getInput());
}
}
}
}

View File

@ -11,12 +11,10 @@ import net.ME1312.Galaxi.Library.Version.Version;
import net.ME1312.SubData.Server.ClientHandler;
import net.ME1312.SubData.Server.SubDataClient;
import net.ME1312.SubServers.Bungee.Host.*;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi.GalaxiInfo;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.Network.Packet.PacketCheckPermission;
import com.google.gson.Gson;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent;
@ -36,9 +34,6 @@ import java.nio.charset.Charset;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi.GalaxiCommand.description;
import static net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi.GalaxiCommand.help;
/**
* Plugin Command Class
*/
@ -53,15 +48,6 @@ public final class SubCommand extends Command implements TabExecutor {
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"
);
}
/**
@ -77,16 +63,10 @@ public final class SubCommand extends Command implements TabExecutor {
if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("?")) {
sender.sendMessages(printHelp());
} else if (args[0].equalsIgnoreCase("version") || args[0].equalsIgnoreCase("ver")) {
Version galaxi = GalaxiInfo.getVersion();
Version bungee = Util.getDespiteException(() -> (Version) BungeeCord.class.getMethod("getForkVersion").invoke(plugin), null);
Version galaxibuild = GalaxiInfo.getBuild();
Version bungeebuild = Util.getDespiteException(() -> (Version) BungeeCord.class.getMethod("getForkBuild").invoke(plugin), null);
sender.sendMessage("SubServers > These are the platforms and versions that are running SubServers.Bungee:");
sender.sendMessage(" " + Platform.getSystemName() + ' ' + Platform.getSystemVersion() + ((Platform.getSystemBuild() != null)?" (" + Platform.getSystemBuild() + ')':"") + ((!Platform.getSystemArchitecture().equals("unknown"))?" [" + Platform.getSystemArchitecture() + ']':"") + ',');
sender.sendMessage(" Java " + Platform.getJavaVersion() + ((!Platform.getJavaArchitecture().equals("unknown"))?" [" + Platform.getJavaArchitecture() + ']':"") + ',');
if (galaxi != null) Util.isException(() -> sender.sendMessage(" GalaxiEngine v" + galaxi.toExtendedString() + ((galaxibuild != null)?" (" + galaxibuild + ')':"") + ','));
sender.sendMessage(" " + plugin.getBungeeName() + ((plugin.isGalaxi)?" v":" ") + ((bungee != null)?bungee:plugin.getVersion()) + ((bungeebuild != null)?" (" + bungeebuild + ')':"") + ((plugin.isPatched)?" [Patched]":"") + ',');
sender.sendMessage(" " + plugin.getBungeeName() + ' ' + plugin.getVersion() + ((plugin.isPatched)?" [Patched]":"") + ',');
sender.sendMessage(" SubServers.Bungee v" + SubProxy.version.toExtendedString() + ((plugin.api.getWrapperBuild() != null)?" (" + plugin.api.getWrapperBuild() + ')':""));
sender.sendMessage("");
new Thread(() -> {
@ -1143,16 +1123,6 @@ public final class SubCommand extends Command implements TabExecutor {
BungeeServer(SubProxy 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"
);
}
/**
@ -1229,16 +1199,6 @@ public final class SubCommand extends Command implements TabExecutor {
BungeeList(SubProxy 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

@ -16,8 +16,6 @@ import net.ME1312.SubData.Server.SubDataServer;
import net.ME1312.SubServers.Bungee.Event.SubRemoveProxyEvent;
import net.ME1312.SubServers.Bungee.Event.SubStoppedEvent;
import net.ME1312.SubServers.Bungee.Host.*;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi.GalaxiCommand;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi.GalaxiEventListener;
import net.ME1312.SubServers.Bungee.Library.Compatibility.LegacyServerMap;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.Library.ConfigUpdater;
@ -97,7 +95,6 @@ public final class SubProxy extends BungeeCommon implements Listener {
public final Proxy mProxy;
public boolean canSudo = false;
public final boolean isPatched;
public final boolean isGalaxi;
public long resetDate = 0;
private boolean pluginDeployed = false;
private boolean running = false;
@ -111,10 +108,6 @@ public final class SubProxy extends BungeeCommon implements Listener {
SubProxy(PrintStream out, boolean isPatched) throws Exception {
super(SubAPI::getInstance);
this.isPatched = isPatched;
this.isGalaxi = !Util.isException(() ->
Util.reflect(Class.forName("net.ME1312.Galaxi.Engine.CodeManager").getMethod("catalogLibrary", 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));
Logger.get("SubServers").info("Loading SubServers.Bungee v" + version.toString() + " Libraries (for Minecraft " + api.getGameVersion()[api.getGameVersion().length - 1] + ")");
@ -329,7 +322,6 @@ public final class SubProxy extends BungeeCommon implements Listener {
subprotocol.registerCipher("DHE-192", DHE.get(192));
subprotocol.registerCipher("DHE-256", DHE.get(256));
Logger.get("SubServers").info("Loading BungeeCord Libraries...");
if (isGalaxi) Util.reflect(GalaxiEventListener.class.getConstructor(SubProxy.class), this);
}
/**
@ -722,7 +714,6 @@ public final class SubProxy extends BungeeCommon implements Listener {
getPluginManager().registerCommand(plugin, new SubCommand(this, "subservers"));
getPluginManager().registerCommand(plugin, new SubCommand(this, "subserver"));
getPluginManager().registerCommand(plugin, new SubCommand(this, "sub"));
GalaxiCommand.group(SubCommand.class);
if (getReconnectHandler() != null && getReconnectHandler().getClass().equals(SmartFallback.class))
setReconnectHandler(new SmartFallback(config.get().getMap("Settings").getMap("Smart-Fallback", new ObjectMap<>()))); // Re-initialize Smart Fallback

View File

@ -32,12 +32,6 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiEngine</artifactId>
<version>21w24a</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.ME1312.SubServers</groupId>
<artifactId>SubServers.Bungee.Common</artifactId>

View File

@ -14,7 +14,6 @@ import net.ME1312.SubData.Client.Encryption.RSA;
import net.ME1312.SubData.Client.Library.DisconnectReason;
import net.ME1312.SubData.Client.SubDataClient;
import net.ME1312.SubServers.Bungee.BungeeCommon;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi.GalaxiCommand;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Logger;
import net.ME1312.SubServers.Bungee.Library.Fallback.FallbackState;
import net.ME1312.SubServers.Bungee.Library.Fallback.SmartFallback;
@ -76,7 +75,6 @@ public final class ExProxy extends BungeeCommon implements Listener {
public static final Version version = Version.fromString("2.17a");
public final boolean isPatched;
public final boolean isGalaxi;
public long lastReload = -1;
private long resetDate = 0;
private boolean reconnect = false;
@ -85,10 +83,6 @@ public final class ExProxy extends BungeeCommon implements Listener {
ExProxy(PrintStream out, boolean isPatched) throws Exception {
super(SubAPI::getInstance);
this.isPatched = isPatched;
this.isGalaxi = !Util.isException(() ->
Util.reflect(Class.forName("net.ME1312.Galaxi.Engine.CodeManager").getMethod("catalogLibrary", 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));
Logger.get("SubServers").info("Loading SubServers.Sync v" + version.toString() + " Libraries (for Minecraft " + api.getGameVersion()[api.getGameVersion().length - 1] + ")");
@ -257,7 +251,6 @@ public final class ExProxy extends BungeeCommon implements Listener {
getPluginManager().registerCommand(plugin, new SubCommand(this, "subservers"));
getPluginManager().registerCommand(plugin, new SubCommand(this, "subserver"));
getPluginManager().registerCommand(plugin, new SubCommand(this, "sub"));
GalaxiCommand.group(SubCommand.class);
if (getReconnectHandler() != null && getReconnectHandler().getClass().equals(SmartFallback.class))
setReconnectHandler(new SmartFallback(config.get().getMap("Settings").getMap("Smart-Fallback", new ObjectMap<>()))); // Re-initialize Smart Fallback

View File

@ -3,7 +3,6 @@ package net.ME1312.SubServers.Sync;
import net.ME1312.Galaxi.Library.Platform;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.Galaxi.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi.GalaxiInfo;
import java.security.Security;
import java.text.SimpleDateFormat;
@ -47,76 +46,66 @@ public final class Launch {
parser.accepts("version");
parser.accepts("noconsole");
joptsimple.OptionSet options = parser.parse(args);
if(options.has("version") || options.has("v")) {
Version galaxi = GalaxiInfo.getVersion();
Version galaxibuild = GalaxiInfo.getBuild();
if (options.has("version") || options.has("v")) {
System.out.println("");
System.out.println(Platform.getSystemName() + ' ' + Platform.getSystemVersion() + ((Platform.getSystemBuild() != null)?" (" + Platform.getSystemBuild() + ')':"") + ((!Platform.getSystemArchitecture().equals("unknown"))?" [" + Platform.getSystemArchitecture() + ']':"") + ',');
System.out.println("Java " + Platform.getJavaVersion() + ((!Platform.getJavaArchitecture().equals("unknown"))?" [" + Platform.getJavaArchitecture() + ']':"") + ',');
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" + ExProxy.version.toExtendedString() + ((ExProxy.class.getPackage().getSpecificationTitle() != null)?" (" + ExProxy.class.getPackage().getSpecificationTitle() + ')':""));
System.out.println("");
} else {
boolean gb = Util.getDespiteException(() -> Class.forName("net.md_5.bungee.util.GalaxiBungeeInfo").getMethod("get").getReturnType().equals(Class.forName("net.ME1312.Galaxi.Plugin.PluginInfo")), false);
if (gb) {
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.");
} else {
System.out.println("");
System.out.println("*******************************************");
System.out.println("*** Warning: this build is Unofficial ***");
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("*** Please report all issues to ME1312, ***");
System.out.println("*** NOT the Spigot Team. Thank You! ***");
System.out.println("*** Errors may arise on older versions! ***");
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("");
}
ExProxy plugin = new ExProxy(System.out, patched);
net.md_5.bungee.api.ProxyServer.class.getMethod("setInstance", net.md_5.bungee.api.ProxyServer.class).invoke(null, plugin);
if (!gb) plugin.getLogger().info("Enabled " + plugin.getBungeeName() + " version " + plugin.getVersion());
plugin.start();
ExProxy plugin = new ExProxy(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());
plugin.start();
if (!options.has("noconsole")) {
if (!gb) try {
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 {
String line;
while (plugin.isRunning && (line = plugin.getConsoleReader().readLine(">")) != null) {
if (!plugin.getPluginManager().dispatchCommand(net.md_5.bungee.command.ConsoleCommandSender.class.cast(net.md_5.bungee.command.ConsoleCommandSender.class.getMethod("getInstance").invoke(null)), line)) {
plugin.getConsole().sendMessage(net.md_5.bungee.api.ChatColor.RED + "Command not found");
}
if (!options.has("noconsole")) {
try {
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 {
String line;
while (plugin.isRunning && (line = plugin.getConsoleReader().readLine(">")) != null) {
if (!plugin.getPluginManager().dispatchCommand(net.md_5.bungee.command.ConsoleCommandSender.class.cast(net.md_5.bungee.command.ConsoleCommandSender.class.getMethod("getInstance").invoke(null)), line)) {
plugin.getConsole().sendMessage(net.md_5.bungee.api.ChatColor.RED + "Command not found");
}
}
} catch (NoSuchMethodError | NoSuchMethodException e) {
plugin.getLogger().warning("Standard BungeeCord console not found; Console commands may now be disabled.");
}
} catch (NoSuchMethodError | NoSuchMethodException e) {
plugin.getLogger().warning("Standard BungeeCord console not found; Console commands may now be disabled.");
}
}
}

View File

@ -13,7 +13,6 @@ import net.ME1312.Galaxi.Library.Util;
import net.ME1312.Galaxi.Library.Version.Version;
import net.ME1312.SubData.Client.SubDataClient;
import net.ME1312.SubData.Client.SubDataSender;
import net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi.GalaxiInfo;
import net.ME1312.SubServers.Client.Common.Network.API.*;
import net.ME1312.SubServers.Client.Common.Network.Packet.PacketCreateServer;
import net.ME1312.SubServers.Client.Common.Network.Packet.PacketUpdateServer;
@ -24,7 +23,6 @@ import net.ME1312.SubServers.Sync.Server.ServerImpl;
import net.ME1312.SubServers.Sync.Server.SubServerImpl;
import com.google.gson.Gson;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent;
@ -44,9 +42,6 @@ import java.nio.charset.Charset;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi.GalaxiCommand.description;
import static net.ME1312.SubServers.Bungee.Library.Compatibility.Galaxi.GalaxiCommand.help;
@SuppressWarnings("deprecation")
public final class SubCommand extends Command implements TabExecutor {
static HashMap<UUID, HashMap<ServerInfo, Pair<Long, Boolean>>> permitted = new HashMap<UUID, HashMap<ServerInfo, Pair<Long, Boolean>>>();
@ -62,15 +57,6 @@ public final class SubCommand extends Command implements TabExecutor {
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")
@ -85,16 +71,10 @@ public final class SubCommand extends Command implements TabExecutor {
if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("?")) {
sender.sendMessages(printHelp());
} else if (args[0].equalsIgnoreCase("version") || args[0].equalsIgnoreCase("ver")) {
Version galaxi = GalaxiInfo.getVersion();
Version bungee = Util.getDespiteException(() -> (Version) BungeeCord.class.getMethod("getForkVersion").invoke(plugin), null);
Version galaxibuild = GalaxiInfo.getBuild();
Version bungeebuild = Util.getDespiteException(() -> (Version) BungeeCord.class.getMethod("getForkBuild").invoke(plugin), null);
sender.sendMessage("SubServers > These are the platforms and versions that are running SubServers.Sync:");
sender.sendMessage(" " + Platform.getSystemName() + ' ' + Platform.getSystemVersion() + ((Platform.getSystemBuild() != null)?" (" + Platform.getSystemBuild() + ')':"") + ((!Platform.getSystemArchitecture().equals("unknown"))?" [" + Platform.getSystemArchitecture() + ']':"") + ',');
sender.sendMessage(" Java " + Platform.getJavaVersion() + ((!Platform.getJavaArchitecture().equals("unknown"))?" [" + Platform.getJavaArchitecture() + ']':"") + ',');
if (galaxi != null) Util.isException(() -> sender.sendMessage(" GalaxiEngine v" + galaxi.toExtendedString() + ((galaxibuild != null)?" (" + galaxibuild + ')':"") + ','));
sender.sendMessage(" " + plugin.getBungeeName() + ((plugin.isGalaxi)?" v":" ") + ((bungee != null)?bungee:plugin.getVersion()) + ((bungeebuild != null)?" (" + bungeebuild + ')':"") + ((plugin.isPatched)?" [Patched]":"") + ',');
sender.sendMessage(" " + plugin.getBungeeName() + ' ' + plugin.getVersion() + ((plugin.isPatched)?" [Patched]":"") + ',');
sender.sendMessage(" SubServers.Sync v" + ExProxy.version.toExtendedString() + ((plugin.api.getWrapperBuild() != null)?" (" + plugin.api.getWrapperBuild() + ')':""));
sender.sendMessage("");
new Thread(() -> {
@ -1422,16 +1402,6 @@ public final class SubCommand extends Command implements TabExecutor {
BungeeServer(ExProxy 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"
);
}
/**
@ -1519,16 +1489,6 @@ public final class SubCommand extends Command implements TabExecutor {
BungeeList(ExProxy 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"
);
}
/**