simple terminal
This commit is contained in:
16
build.gradle
16
build.gradle
@@ -13,3 +13,19 @@ repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
ext {
|
||||
libs_dir = 'libs'
|
||||
jline_version = '3.14.1'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile group: 'org.jline', name: 'jline', version: jline_version
|
||||
compile group: 'org.jline', name: 'jline-terminal-jansi', version: jline_version
|
||||
}
|
||||
|
||||
task copyDeps(type: Copy) {
|
||||
into project.buildDir.toPath().resolve('libs').resolve(libs_dir)
|
||||
from configurations.runtime
|
||||
}
|
||||
jar.dependsOn(copyDeps)
|
||||
|
||||
@@ -1,8 +1,22 @@
|
||||
package mc.server;
|
||||
|
||||
import org.jline.reader.LineReader;
|
||||
import org.jline.reader.LineReaderBuilder;
|
||||
import org.jline.reader.UserInterruptException;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("hello?");
|
||||
LineReader reader = LineReaderBuilder.builder().build();
|
||||
|
||||
try {
|
||||
//noinspection InfiniteLoopStatement
|
||||
while (true) {
|
||||
String line = reader.readLine();
|
||||
System.out.println("line = '" + line + "'");
|
||||
}
|
||||
} catch (UserInterruptException ignore) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user