PaperMC/paper-server/patches/sources/net/minecraft/server/gui/MinecraftServerGui.java.patch
AlexProgrammerDE 73deb32107 Improve ServerGUI
- Added logo to server frame
- Show tps in the server stats
2020-10-03 08:27:40 +02:00

55 lines
2.5 KiB
Diff

--- a/net/minecraft/server/gui/MinecraftServerGui.java
+++ b/net/minecraft/server/gui/MinecraftServerGui.java
@@ -59,6 +59,15 @@
jframe.pack();
jframe.setLocationRelativeTo((Component) null);
jframe.setVisible(true);
+ jframe.setName("Minecraft server"); // Paper - Improve ServerGUI
+
+ // Paper start - Improve ServerGUI
+ try {
+ jframe.setIconImage(javax.imageio.ImageIO.read(Objects.requireNonNull(MinecraftServerGui.class.getClassLoader().getResourceAsStream("logo.png"))));
+ } catch (java.io.IOException ignore) {
+ }
+ // Paper end - Improve ServerGUI
+
jframe.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowevent) {
if (!servergui.isClosing.getAndSet(true)) {
@@ -95,8 +104,8 @@
private JComponent buildInfoPanel() {
JPanel jpanel = new JPanel(new BorderLayout());
- StatsComponent guistatscomponent = new StatsComponent(this.server);
- Collection collection = this.finalizers;
+ com.destroystokyo.paper.gui.GuiStatsComponent guistatscomponent = new com.destroystokyo.paper.gui.GuiStatsComponent(this.server); // Paper - Make GUI graph fancier
+ Collection<Runnable> collection = this.finalizers; // CraftBukkit - decompile error
Objects.requireNonNull(guistatscomponent);
collection.add(guistatscomponent::close);
@@ -132,7 +141,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 +175,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 +191,7 @@
}
try {
- document.insertString(document.getLength(), message, (AttributeSet) null);
+ document.insertString(document.getLength(), MinecraftServerGui.ANSI.matcher(message).replaceAll(""), (AttributeSet) null); // CraftBukkit
} catch (BadLocationException badlocationexception) {
;
}