From 0951c6f971d1286dc9dc92865292596422732b0f Mon Sep 17 00:00:00 2001 From: Haarolean Date: Tue, 14 Nov 2017 17:06:20 +0300 Subject: [PATCH] Fix for paperspigot. Added bundled jline. Works with both spigot and paperspigot now. --- pom.xml | 8 +++++++- .../com/ryanmichela/sshd/ConsoleCommandCompleter.java | 2 +- .../java/com/ryanmichela/sshd/ConsoleShellFactory.java | 9 +++++---- .../java/com/ryanmichela/sshd/FlushyStreamHandler.java | 2 +- src/main/java/com/ryanmichela/sshd/SshTerminal.java | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 52e03b9..e116e5c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.ryanmichela SSHD - 1.3 + 1.3.1 http://dev.bukkit.org/server-mods/sshd/ @@ -62,6 +62,12 @@ 1.7.25 + + jline + jline + 2.12.1 + + diff --git a/src/main/java/com/ryanmichela/sshd/ConsoleCommandCompleter.java b/src/main/java/com/ryanmichela/sshd/ConsoleCommandCompleter.java index ef27f5c..975d37f 100644 --- a/src/main/java/com/ryanmichela/sshd/ConsoleCommandCompleter.java +++ b/src/main/java/com/ryanmichela/sshd/ConsoleCommandCompleter.java @@ -6,7 +6,7 @@ package com.ryanmichela.sshd; import org.bukkit.Bukkit; import org.bukkit.command.CommandMap; -import org.bukkit.craftbukkit.libs.jline.console.completer.Completer; +import jline.console.completer.Completer; import java.util.List; import java.util.concurrent.ExecutionException; diff --git a/src/main/java/com/ryanmichela/sshd/ConsoleShellFactory.java b/src/main/java/com/ryanmichela/sshd/ConsoleShellFactory.java index 2f8e875..3347352 100644 --- a/src/main/java/com/ryanmichela/sshd/ConsoleShellFactory.java +++ b/src/main/java/com/ryanmichela/sshd/ConsoleShellFactory.java @@ -1,5 +1,6 @@ package com.ryanmichela.sshd; +import jline.console.ConsoleReader; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.Logger; import org.apache.sshd.common.Factory; @@ -7,7 +8,6 @@ import org.apache.sshd.server.Command; import org.apache.sshd.server.Environment; import org.apache.sshd.server.ExitCallback; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import java.io.IOException; import java.io.InputStream; @@ -92,17 +92,18 @@ public class ConsoleShellFactory implements Factory { } public void run() { - String command; try { printPreamble(consoleReader); while (true) { - command = consoleReader.readLine("\r>", null); + String command = consoleReader.readLine("\r>", null); if (command != null) { if (command.equals("exit")) { break; } SshdPlugin.instance.getLogger().info("<" + environment.getEnv().get(Environment.ENV_USER) + "> " + command); - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command); + Bukkit.getScheduler().runTask(SshdPlugin.instance, () -> { + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command); + }); } } } catch (IOException e) { diff --git a/src/main/java/com/ryanmichela/sshd/FlushyStreamHandler.java b/src/main/java/com/ryanmichela/sshd/FlushyStreamHandler.java index cb924f0..79aad4c 100644 --- a/src/main/java/com/ryanmichela/sshd/FlushyStreamHandler.java +++ b/src/main/java/com/ryanmichela/sshd/FlushyStreamHandler.java @@ -1,7 +1,7 @@ package com.ryanmichela.sshd; import org.apache.sshd.common.SshException; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; +import jline.console.ConsoleReader; import java.io.IOException; diff --git a/src/main/java/com/ryanmichela/sshd/SshTerminal.java b/src/main/java/com/ryanmichela/sshd/SshTerminal.java index a777324..64ad2d5 100644 --- a/src/main/java/com/ryanmichela/sshd/SshTerminal.java +++ b/src/main/java/com/ryanmichela/sshd/SshTerminal.java @@ -1,6 +1,6 @@ package com.ryanmichela.sshd; -import org.bukkit.craftbukkit.libs.jline.TerminalSupport; +import jline.TerminalSupport; /** * Copyright 2013 Ryan Michela