Support CTRL+D for exiting the console
Support CTRL+D for exiting the console, also support "cls" for clearing the screen (on supported terminals).
This commit is contained in:
parent
0635ea7a35
commit
0e05bb61bc
@ -116,10 +116,21 @@ public class ConsoleShellFactory implements ShellFactory {
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
String command = this.ConsoleReader.readLine("\r>", null);
|
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;
|
continue;
|
||||||
|
// User wants to exit
|
||||||
if (command.equals("exit") || command.equals("quit"))
|
if (command.equals("exit") || command.equals("quit"))
|
||||||
break;
|
break;
|
||||||
|
// Clear the text from the screen (on supported terminals)
|
||||||
|
if (command.equals("cls"))
|
||||||
|
{
|
||||||
|
this.ConsoleReader.clearScreen();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(
|
Bukkit.getScheduler().runTask(
|
||||||
SshdPlugin.instance, () ->
|
SshdPlugin.instance, () ->
|
||||||
|
Loading…
Reference in New Issue
Block a user