diff options
Diffstat (limited to 'patches/server/0318-Make-the-GUI-graph-fancier.patch')
-rw-r--r-- | patches/server/0318-Make-the-GUI-graph-fancier.patch | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/patches/server/0318-Make-the-GUI-graph-fancier.patch b/patches/server/0318-Make-the-GUI-graph-fancier.patch index 9e79ca7b91..25e1012aa6 100644 --- a/patches/server/0318-Make-the-GUI-graph-fancier.patch +++ b/patches/server/0318-Make-the-GUI-graph-fancier.patch @@ -236,10 +236,10 @@ index 0000000000000000000000000000000000000000..f93373d28d741e1f8a53e07b4e328ce9 +} diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMGraph.java b/src/main/java/com/destroystokyo/paper/gui/RAMGraph.java new file mode 100644 -index 0000000000000000000000000000000000000000..c3e54da4ab6440811aab2f9dd1e218802ac13285 +index 0000000000000000000000000000000000000000..a844669c57290cbdf66245d91fc9d2fbf23ba947 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/gui/RAMGraph.java -@@ -0,0 +1,144 @@ +@@ -0,0 +1,156 @@ +package com.destroystokyo.paper.gui; + +import javax.swing.JComponent; @@ -313,7 +313,14 @@ index 0000000000000000000000000000000000000000..c3e54da4ab6440811aab2f9dd1e21880 + Runtime jvm = Runtime.getRuntime(); + DATA.add(new GraphData(jvm.totalMemory(), jvm.freeMemory(), jvm.maxMemory())); + -+ PointerInfo pointerInfo = MouseInfo.getPointerInfo(); ++ PointerInfo pointerInfo = null; ++ // I think I recall spotting a bug report where this throwed an exception once ++ // not sure it's of concern here ++ try { ++ pointerInfo = MouseInfo.getPointerInfo(); ++ } catch (NullPointerException | ArrayIndexOutOfBoundsException ignored) { ++ // https://bugs.openjdk.org/browse/JDK-6840067 ++ } + if (pointerInfo != null) { + Point point = pointerInfo.getLocation(); + if (point != null) { @@ -360,7 +367,12 @@ index 0000000000000000000000000000000000000000..c3e54da4ab6440811aab2f9dd1e21880 + graphics.setColor(new Color(0xFF000000)); + graphics.drawRect(0, 0, 348, 100); + -+ Point m = getMousePosition(); ++ Point m = null; ++ try { ++ m = getMousePosition(); ++ } catch (NullPointerException ignored) { ++ // https://bugs.openjdk.org/browse/JDK-6840067 ++ } + if (m != null && m.x > 0 && m.x < 348 && m.y > 0 && m.y < 100) { + GraphData data = DATA.get(m.x); + int used = data.getUsedPercent(); |