From d65ea30ee5205a965ae22f3acb34c7792c28d7d2 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sat, 5 Sep 2020 22:17:33 +0200 Subject: [PATCH] Fix main page and improve playerlist --- src/main/java/Xera/Monitor/PlayerGeter.java | 15 ++++++++++----- src/main/java/Xera/Monitor/WebServer.java | 2 +- src/main/java/Xera/Monitor/XeraMonitor.java | 6 +++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main/java/Xera/Monitor/PlayerGeter.java b/src/main/java/Xera/Monitor/PlayerGeter.java index 2b4be07..4d726b2 100644 --- a/src/main/java/Xera/Monitor/PlayerGeter.java +++ b/src/main/java/Xera/Monitor/PlayerGeter.java @@ -15,13 +15,18 @@ public static String getPlayers() { players.add(pl.getName()); } - for (int i = 0; i < players.size(); i++) { - if (i == (players.size() - 1)) { - p.append(players.get(i)); - } else { - p.append(players.get(i)).append(", "); + if (players.size() < 1) { + p.append("none"); + } else { + for (int i = 0; i < players.size(); i++) { + if (i == (players.size() - 1)) { + p.append(players.get(i)); + } else { + p.append(players.get(i)).append(", "); + } } } + return p.toString(); } diff --git a/src/main/java/Xera/Monitor/WebServer.java b/src/main/java/Xera/Monitor/WebServer.java index 5edb86c..bda036f 100644 --- a/src/main/java/Xera/Monitor/WebServer.java +++ b/src/main/java/Xera/Monitor/WebServer.java @@ -27,7 +27,7 @@ public void handle(HttpExchange t) { StringBuilder contentBuilder = new StringBuilder(); try { - BufferedReader in = new BufferedReader(new FileReader("plugins/LeeesTpsMonitor/index.html")); + BufferedReader in = new BufferedReader(new FileReader("plugins/XeraMonitor/index.html")); String str; while ((str = in.readLine()) != null) { diff --git a/src/main/java/Xera/Monitor/XeraMonitor.java b/src/main/java/Xera/Monitor/XeraMonitor.java index 831f047..189845f 100644 --- a/src/main/java/Xera/Monitor/XeraMonitor.java +++ b/src/main/java/Xera/Monitor/XeraMonitor.java @@ -46,12 +46,12 @@ public void onEnable() { "

\n" + " \n" + "

XeraMonitor

\n" + - "

TPS:

server_tps

\n" + + "

TPS:

%server_tps%

\n" + "
\n" + - "

PlayerCount:

server_playercount

\n" + + "

PlayerCount:

%server_playercount%

\n" + "
\n" + "

PlayerList:

\n" + - "

server_playerlist

\n" + + "

%server_playerlist%

\n" + " \n" + "