mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 18:37:42 +01:00
More GUI work
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,16 +1,16 @@
|
|||||||
From 05e998cef7295ffb4bdfbd3d237d586b17b6d187 Mon Sep 17 00:00:00 2001
|
From 253b800c81e54ac67f69583a557f52d7dc390b3e Mon Sep 17 00:00:00 2001
|
||||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||||
Date: Wed, 22 Jan 2020 20:13:40 -0600
|
Date: Wed, 22 Jan 2020 20:13:40 -0600
|
||||||
Subject: [PATCH] UPnP Port Forwarding Service
|
Subject: [PATCH] UPnP Port Forwarding Service
|
||||||
|
|
||||||
---
|
---
|
||||||
pom.xml | 10 +++++
|
pom.xml | 10 ++++
|
||||||
.../net/minecraft/server/DedicatedServer.java | 25 +++++++++++
|
.../net/minecraft/server/DedicatedServer.java | 25 ++++++++++
|
||||||
.../net/minecraft/server/MinecraftServer.java | 11 +++++
|
.../net/minecraft/server/MinecraftServer.java | 11 +++++
|
||||||
.../java/net/pl3x/purpur/PurpurConfig.java | 5 +++
|
.../java/net/pl3x/purpur/PurpurConfig.java | 5 ++
|
||||||
.../pl3x/purpur/gui/info/ServerInfoPanel.java | 4 ++
|
.../net/pl3x/purpur/gui/info/JInfoPanel.java | 3 ++
|
||||||
.../pl3x/purpur/gui/info/UPnPComponent.java | 45 +++++++++++++++++++
|
.../pl3x/purpur/gui/info/UPnPComponent.java | 47 +++++++++++++++++++
|
||||||
6 files changed, 100 insertions(+)
|
6 files changed, 101 insertions(+)
|
||||||
create mode 100644 src/main/java/net/pl3x/purpur/gui/info/UPnPComponent.java
|
create mode 100644 src/main/java/net/pl3x/purpur/gui/info/UPnPComponent.java
|
||||||
|
|
||||||
diff --git a/pom.xml b/pom.xml
|
diff --git a/pom.xml b/pom.xml
|
||||||
@@ -122,23 +122,15 @@ index 544c68b0d8..917f6503d2 100644
|
|||||||
public static double laggingThreshold = 19.0D;
|
public static double laggingThreshold = 19.0D;
|
||||||
private static void tickLoopSettings() {
|
private static void tickLoopSettings() {
|
||||||
laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold);
|
laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold);
|
||||||
diff --git a/src/main/java/net/pl3x/purpur/gui/info/ServerInfoPanel.java b/src/main/java/net/pl3x/purpur/gui/info/ServerInfoPanel.java
|
diff --git a/src/main/java/net/pl3x/purpur/gui/info/JInfoPanel.java b/src/main/java/net/pl3x/purpur/gui/info/JInfoPanel.java
|
||||||
index c4519794c9..2d9d1859d9 100644
|
index a4983863cb..82fbb61659 100644
|
||||||
--- a/src/main/java/net/pl3x/purpur/gui/info/ServerInfoPanel.java
|
--- a/src/main/java/net/pl3x/purpur/gui/info/JInfoPanel.java
|
||||||
+++ b/src/main/java/net/pl3x/purpur/gui/info/ServerInfoPanel.java
|
+++ b/src/main/java/net/pl3x/purpur/gui/info/JInfoPanel.java
|
||||||
@@ -11,6 +11,7 @@ public class ServerInfoPanel extends JPanel {
|
@@ -19,13 +19,16 @@ public class JInfoPanel extends JPanel {
|
||||||
private final Timer timer;
|
|
||||||
private final RAMGraph ramGraph;
|
|
||||||
private final RAMDetails ramDetails;
|
|
||||||
+ private final UPnPComponent upnpComponent;
|
|
||||||
|
|
||||||
public ServerInfoPanel(MinecraftServer server) {
|
|
||||||
super(new BorderLayout());
|
|
||||||
@@ -19,13 +20,16 @@ public class ServerInfoPanel extends JPanel {
|
|
||||||
|
|
||||||
ramGraph = new RAMGraph();
|
ramGraph = new RAMGraph();
|
||||||
ramDetails = new RAMDetails(server);
|
RAMDetails ramDetails = new RAMDetails();
|
||||||
+ upnpComponent = new UPnPComponent(server);
|
+ UPnPComponent upnpComponent = new UPnPComponent(server);
|
||||||
|
|
||||||
add(ramGraph, "North");
|
add(ramGraph, "North");
|
||||||
add(ramDetails, "Center");
|
add(ramDetails, "Center");
|
||||||
@@ -146,17 +138,17 @@ index c4519794c9..2d9d1859d9 100644
|
|||||||
|
|
||||||
timer = new Timer(500, (event) -> {
|
timer = new Timer(500, (event) -> {
|
||||||
ramGraph.update();
|
ramGraph.update();
|
||||||
ramDetails.update(ramGraph);
|
ramDetails.update();
|
||||||
+ upnpComponent.repaint();
|
+ upnpComponent.repaint();
|
||||||
});
|
});
|
||||||
timer.start();
|
timer.start();
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/pl3x/purpur/gui/info/UPnPComponent.java b/src/main/java/net/pl3x/purpur/gui/info/UPnPComponent.java
|
diff --git a/src/main/java/net/pl3x/purpur/gui/info/UPnPComponent.java b/src/main/java/net/pl3x/purpur/gui/info/UPnPComponent.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..af6a7e18f3
|
index 0000000000..b0465d3608
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/net/pl3x/purpur/gui/info/UPnPComponent.java
|
+++ b/src/main/java/net/pl3x/purpur/gui/info/UPnPComponent.java
|
||||||
@@ -0,0 +1,45 @@
|
@@ -0,0 +1,47 @@
|
||||||
+package net.pl3x.purpur.gui.info;
|
+package net.pl3x.purpur.gui.info;
|
||||||
+
|
+
|
||||||
+import net.minecraft.server.MinecraftServer;
|
+import net.minecraft.server.MinecraftServer;
|
||||||
@@ -171,11 +163,13 @@ index 0000000000..af6a7e18f3
|
|||||||
+public class UPnPComponent extends JTextPane {
|
+public class UPnPComponent extends JTextPane {
|
||||||
+ private final MinecraftServer server;
|
+ private final MinecraftServer server;
|
||||||
+
|
+
|
||||||
+ UPnPComponent(MinecraftServer server) {
|
+ public UPnPComponent(MinecraftServer server) {
|
||||||
+ this.server = server;
|
+ this.server = server;
|
||||||
+ setBorder(new EmptyBorder(0, 30, 0, 10));
|
+ setBorder(new EmptyBorder(0, 30, 0, 10));
|
||||||
|
+ setEditable(false);
|
||||||
+ setText("UPnP Status");
|
+ setText("UPnP Status");
|
||||||
+ setOpaque(false);
|
+ setOpaque(false);
|
||||||
|
+ setHighlighter(null);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
|
|||||||
@@ -1,41 +1,29 @@
|
|||||||
From fe123a5e92ad8528ba7093f834591f403525f6e9 Mon Sep 17 00:00:00 2001
|
From 13adbf70a09ba38f64b77b40cb5db808987850c7 Mon Sep 17 00:00:00 2001
|
||||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||||
Date: Thu, 30 Jan 2020 00:41:24 -0600
|
Date: Thu, 30 Jan 2020 00:41:24 -0600
|
||||||
Subject: [PATCH] Add tick times API
|
Subject: [PATCH] Add tick times API
|
||||||
|
|
||||||
---
|
---
|
||||||
.../net/pl3x/purpur/gui/info/RAMDetails.java | 13 +++----------
|
.../net/pl3x/purpur/gui/info/RAMDetails.java | 10 +---------
|
||||||
.../org/bukkit/craftbukkit/CraftServer.java | 15 +++++++++++++++
|
.../org/bukkit/craftbukkit/CraftServer.java | 15 +++++++++++++++
|
||||||
.../org/spigotmc/TicksPerSecondCommand.java | 18 +++++++++++++++++-
|
.../org/spigotmc/TicksPerSecondCommand.java | 18 +++++++++++++++++-
|
||||||
3 files changed, 35 insertions(+), 11 deletions(-)
|
3 files changed, 33 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/main/java/net/pl3x/purpur/gui/info/RAMDetails.java b/src/main/java/net/pl3x/purpur/gui/info/RAMDetails.java
|
diff --git a/src/main/java/net/pl3x/purpur/gui/info/RAMDetails.java b/src/main/java/net/pl3x/purpur/gui/info/RAMDetails.java
|
||||||
index b1ea91b49b..2981afaaaa 100644
|
index 00f79e4336..9fe2550a4c 100644
|
||||||
--- a/src/main/java/net/pl3x/purpur/gui/info/RAMDetails.java
|
--- a/src/main/java/net/pl3x/purpur/gui/info/RAMDetails.java
|
||||||
+++ b/src/main/java/net/pl3x/purpur/gui/info/RAMDetails.java
|
+++ b/src/main/java/net/pl3x/purpur/gui/info/RAMDetails.java
|
||||||
@@ -2,6 +2,7 @@ package net.pl3x.purpur.gui.info;
|
@@ -15,7 +15,7 @@ import java.util.Locale;
|
||||||
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.server.SystemUtils;
|
|
||||||
+import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import javax.swing.DefaultListCellRenderer;
|
|
||||||
import javax.swing.JList;
|
|
||||||
@@ -13,7 +14,7 @@ import java.util.Locale;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
public class RAMDetails extends JList<String> {
|
public class RAMDetails extends JList<String> {
|
||||||
- private static final DecimalFormat DECIMAL_FORMAT = SystemUtils.a(new DecimalFormat("########0.000"), (format)
|
- private static final DecimalFormat DECIMAL_FORMAT = SystemUtils.a(new DecimalFormat("########0.000"), (format)
|
||||||
+ public static final DecimalFormat DECIMAL_FORMAT = SystemUtils.a(new DecimalFormat("########0.000"), (format)
|
+ public static final DecimalFormat DECIMAL_FORMAT = SystemUtils.a(new DecimalFormat("########0.000"), (format)
|
||||||
-> format.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)));
|
-> format.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)));
|
||||||
private final MinecraftServer server;
|
|
||||||
|
|
||||||
@@ -38,15 +39,7 @@ public class RAMDetails extends JList<String> {
|
public RAMDetails() {
|
||||||
Vector<String> vector = new Vector<>();
|
@@ -43,12 +43,4 @@ public class RAMDetails extends JList<String> {
|
||||||
vector.add("Memory use: " + (graph.usedMem / 1024L / 1024L) + " mb (" + (graph.free * 100L / graph.max) + "% free)");
|
vector.add("Avg tick: " + DECIMAL_FORMAT.format(Bukkit.getAverageTickTime()) + " ms");
|
||||||
vector.add("Heap: " + (graph.total / 1024L / 1024L) + " / " + (graph.max / 1024L / 1024L) + " mb");
|
|
||||||
- vector.add("Avg tick: " + DECIMAL_FORMAT.format(getAverage(server.getTickTimes()) * 1.0E-6D) + " ms");
|
|
||||||
+ vector.add("Avg tick: " + DECIMAL_FORMAT.format(Bukkit.getAverageTickTime()) + " ms");
|
|
||||||
setListData(vector);
|
setListData(vector);
|
||||||
}
|
}
|
||||||
-
|
-
|
||||||
|
|||||||
Reference in New Issue
Block a user