Fix for paperspigot. Added bundled jline. Works with both spigot and paperspigot now.
This commit is contained in:
parent
5a9a5245b9
commit
0951c6f971
8
pom.xml
8
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.ryanmichela</groupId>
|
<groupId>com.ryanmichela</groupId>
|
||||||
<artifactId>SSHD</artifactId>
|
<artifactId>SSHD</artifactId>
|
||||||
<version>1.3</version>
|
<version>1.3.1</version>
|
||||||
<url>http://dev.bukkit.org/server-mods/sshd/</url>
|
<url>http://dev.bukkit.org/server-mods/sshd/</url>
|
||||||
|
|
||||||
<!-- Repositories -->
|
<!-- Repositories -->
|
||||||
@ -62,6 +62,12 @@
|
|||||||
<version>1.7.25</version>
|
<version>1.7.25</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>jline</groupId>
|
||||||
|
<artifactId>jline</artifactId>
|
||||||
|
<version>2.12.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<!-- Build -->
|
<!-- Build -->
|
||||||
|
@ -6,7 +6,7 @@ package com.ryanmichela.sshd;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandMap;
|
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.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.ryanmichela.sshd;
|
package com.ryanmichela.sshd;
|
||||||
|
|
||||||
|
import jline.console.ConsoleReader;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.core.Logger;
|
import org.apache.logging.log4j.core.Logger;
|
||||||
import org.apache.sshd.common.Factory;
|
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.Environment;
|
||||||
import org.apache.sshd.server.ExitCallback;
|
import org.apache.sshd.server.ExitCallback;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -92,17 +92,18 @@ public class ConsoleShellFactory implements Factory<Command> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
String command;
|
|
||||||
try {
|
try {
|
||||||
printPreamble(consoleReader);
|
printPreamble(consoleReader);
|
||||||
while (true) {
|
while (true) {
|
||||||
command = consoleReader.readLine("\r>", null);
|
String command = consoleReader.readLine("\r>", null);
|
||||||
if (command != null) {
|
if (command != null) {
|
||||||
if (command.equals("exit")) {
|
if (command.equals("exit")) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SshdPlugin.instance.getLogger().info("<" + environment.getEnv().get(Environment.ENV_USER) + "> " + command);
|
SshdPlugin.instance.getLogger().info("<" + environment.getEnv().get(Environment.ENV_USER) + "> " + command);
|
||||||
|
Bukkit.getScheduler().runTask(SshdPlugin.instance, () -> {
|
||||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.ryanmichela.sshd;
|
package com.ryanmichela.sshd;
|
||||||
|
|
||||||
import org.apache.sshd.common.SshException;
|
import org.apache.sshd.common.SshException;
|
||||||
import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader;
|
import jline.console.ConsoleReader;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.ryanmichela.sshd;
|
package com.ryanmichela.sshd;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.libs.jline.TerminalSupport;
|
import jline.TerminalSupport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright 2013 Ryan Michela
|
* Copyright 2013 Ryan Michela
|
||||||
|
Loading…
Reference in New Issue
Block a user