Use TerminalConsoleAppender for console improvements

Rewrite console improvements (console colors, tab completion,
persistent input line, ...) using JLine 3.x and TerminalConsoleAppender.

Also uses the new ANSIComponentSerializer to serialize components when
logging them via the ComponentLogger, or when sending messages to the
console, for hex color support.

New features:
  - Support console colors for Vanilla commands
  - Add console colors for warnings and errors
  - Server can now be turned off safely using CTRL + C. JLine catches
    the signal and the implementation shuts down the server cleanly.
  - Support console colors and persistent input line when running in
    IntelliJ IDEA

Other changes:
  - Server starts 1-2 seconds faster thanks to optimizations in Log4j
    configuration

Co-Authored-By: Emilia Kond <emilia@rymiel.space>
This commit is contained in:
Minecrell
2017-06-09 19:03:43 +02:00
parent 66779f5c86
commit 36723cdd60
19 changed files with 343 additions and 133 deletions

View File

@@ -43,7 +43,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import javax.imageio.ImageIO;
import jline.console.ConsoleReader;
// import jline.console.ConsoleReader;
import net.minecraft.advancements.AdvancementHolder;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
@@ -1359,9 +1359,13 @@ public final class CraftServer implements Server {
return this.logger;
}
// Paper start - JLine update
/*
public ConsoleReader getReader() {
return this.console.reader;
}
*/
// Paper end
@Override
public PluginCommand getPluginCommand(String name) {