mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 11:24:11 +01:00
36723cdd60
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>
37 lines
1.7 KiB
Diff
37 lines
1.7 KiB
Diff
--- a/net/minecraft/server/gui/MinecraftServerGui.java
|
|
+++ b/net/minecraft/server/gui/MinecraftServerGui.java
|
|
@@ -96,7 +96,7 @@
|
|
private JComponent buildInfoPanel() {
|
|
JPanel jpanel = new JPanel(new BorderLayout());
|
|
StatsComponent guistatscomponent = new StatsComponent(this.server);
|
|
- Collection collection = this.finalizers;
|
|
+ Collection<Runnable> collection = this.finalizers; // CraftBukkit - decompile error
|
|
|
|
Objects.requireNonNull(guistatscomponent);
|
|
collection.add(guistatscomponent::close);
|
|
@@ -132,7 +132,7 @@
|
|
|
|
jtextfield.setText("");
|
|
});
|
|
- jtextarea.addFocusListener(new FocusAdapter(this) {
|
|
+ jtextarea.addFocusListener(new FocusAdapter() { // CraftBukkit - decompile error
|
|
public void focusGained(FocusEvent focusevent) {}
|
|
});
|
|
jpanel.add(jscrollpane, "Center");
|
|
@@ -166,6 +166,7 @@
|
|
this.finalizers.forEach(Runnable::run);
|
|
}
|
|
|
|
+ private static final java.util.regex.Pattern ANSI = java.util.regex.Pattern.compile("\\e\\[[\\d;]*[^\\d;]"); // CraftBukkit // Paper
|
|
public void print(JTextArea textArea, JScrollPane scrollPane, String message) {
|
|
if (!SwingUtilities.isEventDispatchThread()) {
|
|
SwingUtilities.invokeLater(() -> {
|
|
@@ -181,7 +182,7 @@
|
|
}
|
|
|
|
try {
|
|
- document.insertString(document.getLength(), message, (AttributeSet) null);
|
|
+ document.insertString(document.getLength(), MinecraftServerGui.ANSI.matcher(message).replaceAll(""), (AttributeSet) null); // CraftBukkit
|
|
} catch (BadLocationException badlocationexception) {
|
|
;
|
|
}
|