Add prefixes to the terminal
This commit is contained in:
parent
d28cd483f5
commit
32f79fcc65
2 changed files with 9 additions and 5 deletions
|
@ -9,11 +9,13 @@ import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
|||
public class ConsolePrompt implements Runnable
|
||||
{
|
||||
public static final Console console = System.console();
|
||||
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
// Print a prompt
|
||||
console.printf("\n> ");
|
||||
console.printf("\n"+Terminal.PREFIX+ " > ");
|
||||
String commandInput = console.readLine();
|
||||
|
||||
CommandEvent event = new CommandEvent(commandInput);
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
package dev.zontreck.ariaslib.terminal;
|
||||
|
||||
import java.io.Console;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
|
||||
public class Terminal {
|
||||
private static final AtomicInteger ID = new AtomicInteger(0);
|
||||
private static boolean running=true;
|
||||
private static final AtomicBoolean running= new AtomicBoolean(true);
|
||||
public static String PREFIX = "";
|
||||
/**
|
||||
* This starts a terminal instance
|
||||
* @return The terminal ID
|
||||
*/
|
||||
public static int startTerminal()
|
||||
{
|
||||
running=true;
|
||||
running.set(true);
|
||||
DelayedExecutorService.getInstance().schedule(new ConsolePrompt(), 1);
|
||||
|
||||
|
||||
|
@ -23,11 +25,11 @@ public class Terminal {
|
|||
|
||||
public static boolean isRunning()
|
||||
{
|
||||
return running;
|
||||
return running.get();
|
||||
}
|
||||
|
||||
public static void setRunning(boolean running)
|
||||
{
|
||||
Terminal.running=running;
|
||||
Terminal.running.set(running);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue