Add /mspt command

This commit is contained in:
William Blake Galbreath
2020-03-13 20:14:23 -05:00
parent 76212761ee
commit c1846b3cb5
7 changed files with 212 additions and 82 deletions

View File

@@ -1,4 +1,4 @@
From fe907eb13ca2c2ad64be766bf0579149385f1caa Mon Sep 17 00:00:00 2001
From d9d93f9f020802a8d08bc42879814775142b39e1 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 16 Jan 2020 14:59:16 -0600
Subject: [PATCH] Make the GUI better
@@ -11,7 +11,7 @@ Subject: [PATCH] Make the GUI better
.../purpur/gui/console/JConsolePanel.java | 128 ++++++++++++++++
.../gui/info/DetailsListSelectionModel.java | 21 +++
.../net/pl3x/purpur/gui/info/JInfoPanel.java | 42 +++++
.../net/pl3x/purpur/gui/info/RAMDetails.java | 54 +++++++
.../net/pl3x/purpur/gui/info/RAMDetails.java | 59 +++++++
.../purpur/gui/info/graph/GraphColor.java | 44 ++++++
.../pl3x/purpur/gui/info/graph/GraphData.java | 47 ++++++
.../pl3x/purpur/gui/info/graph/RAMGraph.java | 144 ++++++++++++++++++
@@ -22,7 +22,7 @@ Subject: [PATCH] Make the GUI better
.../net/pl3x/purpur/gui/util/GUIColor.java | 54 +++++++
.../purpur/util/HighlightErrorConverter.java | 86 +++++++++++
src/main/resources/log4j2.xml | 13 +-
18 files changed, 997 insertions(+), 5 deletions(-)
18 files changed, 1002 insertions(+), 5 deletions(-)
create mode 100644 src/main/java/net/pl3x/purpur/gui/ServerGUI.java
create mode 100644 src/main/java/net/pl3x/purpur/gui/console/JColorTextPane.java
create mode 100644 src/main/java/net/pl3x/purpur/gui/console/JConsolePanel.java
@@ -461,7 +461,7 @@ index 0000000000..4e0b80fddb
+}
diff --git a/src/main/java/net/pl3x/purpur/gui/info/JInfoPanel.java b/src/main/java/net/pl3x/purpur/gui/info/JInfoPanel.java
new file mode 100644
index 0000000000..a4983863cb
index 0000000000..c4903c7db6
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/gui/info/JInfoPanel.java
@@ -0,0 +1,42 @@
@@ -485,7 +485,7 @@ index 0000000000..a4983863cb
+ setOpaque(false);
+
+ ramGraph = new RAMGraph();
+ RAMDetails ramDetails = new RAMDetails();
+ RAMDetails ramDetails = new RAMDetails(server);
+
+ add(ramGraph, "North");
+ add(ramDetails, "Center");
@@ -509,12 +509,13 @@ index 0000000000..a4983863cb
+}
diff --git a/src/main/java/net/pl3x/purpur/gui/info/RAMDetails.java b/src/main/java/net/pl3x/purpur/gui/info/RAMDetails.java
new file mode 100644
index 0000000000..00f79e4336
index 0000000000..1e049d575b
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/gui/info/RAMDetails.java
@@ -0,0 +1,54 @@
@@ -0,0 +1,59 @@
+package net.pl3x.purpur.gui.info;
+
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.SystemUtils;
+import net.pl3x.purpur.gui.info.graph.GraphData;
+import net.pl3x.purpur.gui.info.graph.RAMGraph;
@@ -533,7 +534,11 @@ index 0000000000..00f79e4336
+ private static final DecimalFormat DECIMAL_FORMAT = SystemUtils.a(new DecimalFormat("########0.000"), (format)
+ -> format.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)));
+
+ public RAMDetails() {
+ private final MinecraftServer server;
+
+ public RAMDetails(MinecraftServer server) {
+ this.server = server;
+
+ setBorder(new EmptyBorder(0, 10, 0, 0));
+ setFixedCellHeight(20);
+ setOpaque(false);
@@ -555,7 +560,7 @@ index 0000000000..00f79e4336
+ Vector<String> vector = new Vector<>();
+ vector.add("Memory use: " + (data.getUsedMem() / 1024L / 1024L) + " mb (" + (data.getFree() * 100L / data.getMax()) + "% free)");
+ vector.add("Heap: " + (data.getTotal() / 1024L / 1024L) + " / " + (data.getMax() / 1024L / 1024L) + " mb");
+ vector.add("Avg tick: " + DECIMAL_FORMAT.format(Bukkit.getAverageTickTime()) + " ms");
+ vector.add("Avg tick: " + DECIMAL_FORMAT.format(server.tickTimes5s.getAverage()) + " ms");
+ setListData(vector);
+ }
+