Fix for paperspigot. Added bundled jline. Works with both spigot and paperspigot now.

This commit is contained in:
Haarolean 2017-11-14 17:06:20 +03:00
parent 5a9a5245b9
commit 0951c6f971
5 changed files with 15 additions and 8 deletions

View File

@ -6,7 +6,7 @@
<groupId>com.ryanmichela</groupId>
<artifactId>SSHD</artifactId>
<version>1.3</version>
<version>1.3.1</version>
<url>http://dev.bukkit.org/server-mods/sshd/</url>
<!-- Repositories -->
@ -62,6 +62,12 @@
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>2.12.1</version>
</dependency>
</dependencies>
<!-- Build -->

View File

@ -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;

View File

@ -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<Command> {
}
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) {

View File

@ -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;

View File

@ -1,6 +1,6 @@
package com.ryanmichela.sshd;
import org.bukkit.craftbukkit.libs.jline.TerminalSupport;
import jline.TerminalSupport;
/**
* Copyright 2013 Ryan Michela