PaperMC/paper-server/patches/sources/net/minecraft/server/gui/MinecraftServerGui.java.patch
CraftBukkit/Spigot 30e4583dbe Remap CraftBukkit to Mojang+Yarn Mappings
By: Initial Source <noreply+automated@papermc.io>
2024-12-11 22:26:55 +01:00

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("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]"); // CraftBukkit
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) {
;
}