diff --git a/patches/server/Improve-ServerGUI.patch b/patches/server/Improve-ServerGUI.patch index 0989340161..35de6d4971 100644 --- a/patches/server/Improve-ServerGUI.patch +++ b/patches/server/Improve-ServerGUI.patch @@ -15,7 +15,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 GraphData data = RAMGraph.DATA.peekLast(); Vector vector = new Vector<>(); + -+ double[] tps = org.bukkit.Bukkit.getTPS(); ++ // Follows CraftServer#getTPS ++ double[] tps = new double[] { ++ server.tps1.getAverage(), ++ server.tps5.getAverage(), ++ server.tps15.getAverage() ++ }; + String[] tpsAvg = new String[tps.length]; + + for ( int g = 0; g < tps.length; g++) { diff --git a/patches/server/Make-the-GUI-graph-fancier.patch b/patches/server/Make-the-GUI-graph-fancier.patch index d3e5a828db..504f681bc0 100644 --- a/patches/server/Make-the-GUI-graph-fancier.patch +++ b/patches/server/Make-the-GUI-graph-fancier.patch @@ -313,7 +313,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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();