diff --git a/src/main/java/com/ryanmichela/sshd/ConsoleShellFactory.java b/src/main/java/com/ryanmichela/sshd/ConsoleShellFactory.java index de9900c..15acb7c 100644 --- a/src/main/java/com/ryanmichela/sshd/ConsoleShellFactory.java +++ b/src/main/java/com/ryanmichela/sshd/ConsoleShellFactory.java @@ -116,10 +116,21 @@ public class ConsoleShellFactory implements ShellFactory { while (true) { String command = this.ConsoleReader.readLine("\r>", null); - if (command == null || command.trim().isEmpty()) + // The user sent CTRL+D to close the shell, terminate the session. + if (command == null) + break; + // Skip someone spamming enter + if (command.trim().isEmpty()) continue; + // User wants to exit if (command.equals("exit") || command.equals("quit")) break; + // Clear the text from the screen (on supported terminals) + if (command.equals("cls")) + { + this.ConsoleReader.clearScreen(); + continue; + } Bukkit.getScheduler().runTask( SshdPlugin.instance, () -> diff --git a/src/main/java/com/ryanmichela/sshd/SshTerminal.java b/src/main/java/com/ryanmichela/sshd/SshTerminal.java index 64ad2d5..876f1c4 100644 --- a/src/main/java/com/ryanmichela/sshd/SshTerminal.java +++ b/src/main/java/com/ryanmichela/sshd/SshTerminal.java @@ -7,13 +7,13 @@ import jline.TerminalSupport; */ public class SshTerminal extends TerminalSupport { - protected SshTerminal() { - super(true); - } + protected SshTerminal() { + super(true); + } - @Override - public void init() throws Exception { - setAnsiSupported(true); - setEchoEnabled(true); - } + @Override + public void init() throws Exception { + setAnsiSupported(true); + setEchoEnabled(true); + } }