Add direct support for newer waterfall versions

This commit is contained in:
ME1312 2018-05-24 01:05:54 -04:00
parent 5f69459e62
commit c35a31f803
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
25 changed files with 88 additions and 56 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -306,6 +306,8 @@
<dd>
<div class="block">Callback Class</div>
</dd>
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Bungee/SubPlugin.html#canSudo">canSudo</a></span> - Variable in class net.ME1312.SubServers.Bungee.<a href="net/ME1312/SubServers/Bungee/SubPlugin.html" title="class in net.ME1312.SubServers.Bungee">SubPlugin</a></dt>
<dd>&nbsp;</dd>
<dt><a href="net/ME1312/SubServers/Bungee/Network/Cipher.html" title="interface in net.ME1312.SubServers.Bungee.Network"><span class="typeNameLink">Cipher</span></a> - Interface in <a href="net/ME1312/SubServers/Bungee/Network/package-summary.html">net.ME1312.SubServers.Bungee.Network</a></dt>
<dd>
<div class="block">SubData Cipher Layout Class</div>

View File

@ -148,50 +148,54 @@ implements net.md_5.bungee.api.plugin.Listener</pre>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#api">api</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#canSudo">canSudo</a></span></code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../net/ME1312/SubServers/Bungee/Library/Config/YAMLConfig.html" title="class in net.ME1312.SubServers.Bungee.Library.Config">YAMLConfig</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#config">config</a></span></code>&nbsp;</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../net/ME1312/SubServers/Bungee/Library/UniversalFile.html" title="class in net.ME1312.SubServers.Bungee.Library">UniversalFile</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#dir">dir</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>java.util.HashMap&lt;java.lang.String,<a href="../../../../net/ME1312/SubServers/Bungee/Host/Server.html" title="interface in net.ME1312.SubServers.Bungee.Host">Server</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#exServers">exServers</a></span></code>&nbsp;</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>java.util.HashMap&lt;java.lang.String,<a href="../../../../net/ME1312/SubServers/Bungee/Host/Host.html" title="class in net.ME1312.SubServers.Bungee.Host">Host</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#hosts">hosts</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../net/ME1312/SubServers/Bungee/Library/Config/YAMLConfig.html" title="class in net.ME1312.SubServers.Bungee.Library.Config">YAMLConfig</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#langconfig">langconfig</a></span></code>&nbsp;</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>java.io.PrintStream</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#out">out</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>java.util.HashMap&lt;java.lang.String,<a href="../../../../net/ME1312/SubServers/Bungee/Host/Proxy.html" title="class in net.ME1312.SubServers.Bungee.Host">Proxy</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#proxies">proxies</a></span></code>&nbsp;</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#redis">redis</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#resetDate">resetDate</a></span></code>&nbsp;</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../net/ME1312/SubServers/Bungee/Network/SubDataServer.html" title="class in net.ME1312.SubServers.Bungee.Network">SubDataServer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#subdata">subdata</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../net/ME1312/SubServers/Bungee/Host/SubServer.html" title="interface in net.ME1312.SubServers.Bungee.Host">SubServer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#sudo">sudo</a></span></code>&nbsp;</td>
</tr>
<tr class="altColor">
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html" title="class in net.ME1312.SubServers.Bungee.Library.Version">Version</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html#version">version</a></span></code>&nbsp;</td>
</tr>
@ -412,6 +416,15 @@ implements net.md_5.bungee.api.plugin.Listener</pre>
<pre>public&nbsp;boolean redis</pre>
</li>
</ul>
<a name="canSudo">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>canSudo</h4>
<pre>public&nbsp;boolean canSudo</pre>
</li>
</ul>
<a name="resetDate">
<!-- -->
</a>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,4 @@
Manifest-Version: 1.0
Class-Path: BungeeCord.jar
Class-Path: BungeeCord.jar Waterfall.jar
Main-Class: net.ME1312.SubServers.Bungee.Launch
Implementation-Version: SubServers.Bungee

View File

@ -117,7 +117,7 @@ public class ExternalSubLogger extends SubLogger {
}
// Filter Message
boolean allow = log.get() && (SubAPI.getInstance().getInternals().sudo == null || SubAPI.getInstance().getInternals().sudo == getHandler());
boolean allow = log.get() && (!SubAPI.getInstance().getInternals().canSudo || SubAPI.getInstance().getInternals().sudo == null || SubAPI.getInstance().getInternals().sudo == getHandler());
List<SubLogFilter> filters = new ArrayList<SubLogFilter>();
filters.addAll(this.filters);
for (SubLogFilter filter : filters)

View File

@ -108,7 +108,7 @@ public class InternalSubLogger extends SubLogger {
}
// Filter Message
boolean allow = log.get() && (SubAPI.getInstance().getInternals().sudo == null || SubAPI.getInstance().getInternals().sudo == getHandler());
boolean allow = log.get() && (!SubAPI.getInstance().getInternals().canSudo || SubAPI.getInstance().getInternals().sudo == null || SubAPI.getInstance().getInternals().sudo == getHandler());
List<SubLogFilter> filters = new ArrayList<SubLogFilter>();
filters.addAll(this.filters);
for (SubLogFilter filter : filters)

View File

@ -23,10 +23,9 @@ public final class Launch {
public static void main(String[] args) throws Exception {
System.setProperty("apple.laf.useScreenMenuBar", "true");
final Container<Boolean> bungee = new Container<Boolean>(false);
if (Util.isException(() -> {
if (Class.forName("net.md_5.bungee.BungeeCord") != null) bungee.set(true);
}) && !bungee.get()) {
Container<Boolean> bungee = new Container<Boolean>(false);
Container<Boolean> waterfall = new Container<Boolean>(false);
if (Util.isException(() -> bungee.set(Class.forName("net.md_5.bungee.BungeeCord") != null)) && !bungee.get()) {
System.out.println("");
System.out.println("*******************************************");
System.out.println("*** Error: BungeeCord.jar Doesn't Exist ***");
@ -60,7 +59,7 @@ public final class Launch {
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().getImplementationVersion() == null || net.md_5.bungee.BungeeCord.class.getPackage().getImplementationVersion().equals("SubServers.Sync")) 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();
@ -82,28 +81,36 @@ public final class Launch {
}
System.out.println("");
Util.isException(() -> waterfall.set(Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole") != null));
SubPlugin plugin = new SubPlugin(System.out);
net.md_5.bungee.api.ProxyServer.class.getMethod("setInstance", net.md_5.bungee.api.ProxyServer.class).invoke(null, plugin);
plugin.getLogger().info("Enabled BungeeCord version " + plugin.getVersion());
plugin.start();
if (!options.has("noconsole")) {
String line;
try {
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");
if (waterfall.get()) {
plugin.canSudo = false;
Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole").getMethod("readCommands").invoke(null);
} else {
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;
System.out.println("SubServers > Reverting to the BungeeCord Console");
} else {
plugin.sudo.command(line);
}
} else if (line.equalsIgnoreCase("exit")) {
plugin.sudo = null;
System.out.println("SubServers > Reverting to the BungeeCord Console");
} else {
plugin.sudo.command(line);
}
}
} catch (NoSuchMethodError | NoSuchMethodException e) {
plugin.getLogger().warning("Standard BungeeCord console not found; Console commands now disabled.");
plugin.canSudo = false;
plugin.getLogger().warning("Standard BungeeCord console not found; Console commands may now be disabled.");
}
}
}

View File

@ -330,20 +330,24 @@ public final class SubCommand extends CommandX {
sender.sendMessage("SubServers > Usage: " + label + " " + args[0].toLowerCase() + " <SubServer> <Command> [Args...]");
}
} else if (args[0].equalsIgnoreCase("sudo") || args[0].equalsIgnoreCase("screen")) {
if (args.length > 1) {
Map<String, Server> servers = plugin.api.getServers();
if (!args[1].equals("*") && !servers.keySet().contains(args[1].toLowerCase())) {
sender.sendMessage("SubServers > There is no server with that name");
} else if (!args[1].equals("*") && !(servers.get(args[1].toLowerCase()) instanceof SubServer)) {
sender.sendMessage("SubServers > That Server is not a SubServer");
} else if (!args[1].equals("*") && !((SubServer) servers.get(args[1].toLowerCase())).isRunning()) {
sender.sendMessage("SubServers > That SubServer is not running");
if (plugin.canSudo) {
if (args.length > 1) {
Map<String, Server> servers = plugin.api.getServers();
if (!args[1].equals("*") && !servers.keySet().contains(args[1].toLowerCase())) {
sender.sendMessage("SubServers > There is no server with that name");
} else if (!args[1].equals("*") && !(servers.get(args[1].toLowerCase()) instanceof SubServer)) {
sender.sendMessage("SubServers > That Server is not a SubServer");
} else if (!args[1].equals("*") && !((SubServer) servers.get(args[1].toLowerCase())).isRunning()) {
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.");
}
} else {
plugin.sudo = (SubServer) servers.get(args[1].toLowerCase());
System.out.println("SubServers > Now forwarding commands to " + plugin.sudo.getDisplayName() + ". Type \"exit\" to return.");
sender.sendMessage("SubServers > Usage: " + label + " " + args[0].toLowerCase() + " <SubServer>");
}
} else {
sender.sendMessage("SubServers > Usage: " + label + " " + args[0].toLowerCase() + " <SubServer>");
sender.sendMessage("SubServers > The BungeeCord library provided does not support console sudo.");
}
} else if (args[0].equalsIgnoreCase("create")) {
if (args.length > 5) {

View File

@ -60,9 +60,10 @@ public final class SubPlugin extends BungeeCord implements Listener {
public SubServer sudo = null;
//public static final Version version = new Version("2.13a");
//public static final Version version = new Version(new Version("2.13a"), VersionType.BETA, 1); // TODO Beta Version Setting
public static final Version version = new Version(new Version(new Version("2.13a"), VersionType.PRE_RELEASE, 3), VersionType.BETA, 3); // TODO Beta Version Setting
public static final Version version = new Version(new Version(new Version("2.13a"), VersionType.PRE_RELEASE, 3), VersionType.BETA, 4); // TODO Beta Version Setting
public boolean redis = false;
public boolean canSudo = true;
public long resetDate = 0;
private boolean running = false;
private boolean posted = false;

Binary file not shown.

View File

@ -48,7 +48,7 @@ public final class SubPlugin extends JavaPlugin {
super();
//version = new Version(getDescription().getVersion());
//version = new Version(new Version(getDescription().getVersion()), VersionType.BETA, 1); // TODO Beta Version Setting
version = new Version(new Version(new Version(getDescription().getVersion()), VersionType.PRE_RELEASE, 3), VersionType.BETA, 3); // TODO Beta Version Setting
version = new Version(new Version(new Version(getDescription().getVersion()), VersionType.PRE_RELEASE, 3), VersionType.BETA, 4); // TODO Beta Version Setting
}
/**

Binary file not shown.

View File

@ -53,7 +53,7 @@ public final class ExHost {
//public final Version version = new Version("2.13a");
//public final Version version = new Version(new Version("2.13a"), VersionType.BETA, 1); // TODO Beta Version Setting
public final Version version = new Version(new Version(new Version("2.13a"), VersionType.PRE_RELEASE, 3), VersionType.BETA, 3); // TODO Beta Version Setting
public final Version version = new Version(new Version(new Version("2.13a"), VersionType.PRE_RELEASE, 3), VersionType.BETA, 4); // TODO Beta Version Setting
public final SubAPI api = new SubAPI(this);
private ConsoleReader jline;

Binary file not shown.

View File

@ -1,4 +1,4 @@
Manifest-Version: 1.0
Class-Path: BungeeCord.jar
Class-Path: BungeeCord.jar Waterfall.jar
Main-Class: net.ME1312.SubServers.Sync.Launch
Implementation-Version: SubServers.Sync

View File

@ -23,10 +23,9 @@ public final class Launch {
public static void main(String[] args) throws Exception {
System.setProperty("apple.laf.useScreenMenuBar", "true");
final Container<Boolean> bungee = new Container<Boolean>(false);
if (Util.isException(() -> {
if (Class.forName("net.md_5.bungee.BungeeCord") != null) bungee.set(true);
}) && !bungee.get()) {
Container<Boolean> bungee = new Container<Boolean>(false);
Container<Boolean> waterfall = new Container<Boolean>(false);
if (Util.isException(() -> bungee.set(Class.forName("net.md_5.bungee.BungeeCord") != null)) && !bungee.get()) {
System.out.println("");
System.out.println("*******************************************");
System.out.println("*** Error: BungeeCord.jar Doesn't Exist ***");
@ -60,7 +59,7 @@ public final class Launch {
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().getImplementationVersion() == null || net.md_5.bungee.BungeeCord.class.getPackage().getImplementationVersion().equals("SubServers.Sync")) 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();
@ -82,6 +81,8 @@ public final class Launch {
}
System.out.println("");
Util.isException(() -> waterfall.set(Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole") != null));
SubPlugin plugin = new SubPlugin(System.out);
net.md_5.bungee.api.ProxyServer.class.getMethod("setInstance", net.md_5.bungee.api.ProxyServer.class).invoke(null, plugin);
plugin.getLogger().info("Enabled BungeeCord version " + plugin.getVersion());
@ -89,14 +90,18 @@ public final class Launch {
if (!options.has("noconsole")) {
try {
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 (waterfall.get()) {
Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole").getMethod("readCommands").invoke(null);
} 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 now disabled.");
plugin.getLogger().warning("Standard BungeeCord console not found; Console commands may now be disabled.");
}
}
}

View File

@ -50,7 +50,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
public SubDataClient subdata = null;
//public static final Version version = new Version("2.13a");
//public static final Version version = new Version(new Version("2.13a"), VersionType.BETA, 1); // TODO Beta Version Setting
public static final Version version = new Version(new Version(new Version("2.13a"), VersionType.PRE_RELEASE, 3), VersionType.BETA, 3); // TODO Beta Version Setting
public static final Version version = new Version(new Version(new Version("2.13a"), VersionType.PRE_RELEASE, 3), VersionType.BETA, 4); // TODO Beta Version Setting
public long lastReload = -1;