Add compatability for another revision of the WaterfallConsole

This commit is contained in:
ME1312 2018-09-16 15:43:27 -04:00
parent a2e481efe7
commit 82849ef3c7
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
2 changed files with 7 additions and 1 deletions

View File

@ -99,8 +99,11 @@ public final class Launch {
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)) {
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;

View File

@ -101,6 +101,9 @@ public final class Launch {
try {
if (Util.getDespiteException(() -> Class.forName("io.github.waterfallmc.waterfall.console.WaterfallConsole") != null, false)) {
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) {