mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-25 18:47:50 +01:00
Fix compile issues, Added player counts to analysis page
This commit is contained in:
parent
63749b913a
commit
1d4f3237b8
@ -4,9 +4,11 @@
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.systems.info.parsing;
|
||||
|
||||
import com.djrapitops.plugin.utilities.Compatibility;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
import main.java.com.djrapitops.plan.api.IPlan;
|
||||
import main.java.com.djrapitops.plan.api.exceptions.ParseException;
|
||||
import main.java.com.djrapitops.plan.bungee.PlanBungee;
|
||||
import main.java.com.djrapitops.plan.data.AnalysisData;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.file.FileUtil;
|
||||
@ -35,10 +37,20 @@ public class AnalysisPageParser extends PageParser {
|
||||
addValue("tabContentPlugins", data.replacePluginsTabLayout());
|
||||
addValue("serverName", Settings.SERVER_NAME.toString());
|
||||
addValue("timeZone", MiscUtils.getTimeZoneOffsetHours());
|
||||
|
||||
addValue("playersMax", plugin.getVariable().getMaxPlayers());
|
||||
addValue("playersOnline", getPlayersOnline());
|
||||
try {
|
||||
return HtmlUtils.replacePlaceholders(FileUtil.getStringFromResource("server.html"), placeHolders);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new ParseException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private int getPlayersOnline() {
|
||||
if (Compatibility.isBukkitAvailable()) {
|
||||
return plugin.fetch().getOnlinePlayers().size();
|
||||
}
|
||||
return ((PlanBungee) plugin).getProxy().getOnlineCount();
|
||||
}
|
||||
}
|
@ -60,7 +60,7 @@ public class DatabaseTest {
|
||||
db = new SQLiteDB(plan, "debug" + MiscUtils.getTime());
|
||||
db.init();
|
||||
|
||||
db.getServerTable().saveCurrentServerInfo(new ServerInfo(-1, TestInit.getServerUUID(), "ServerName", ""));
|
||||
db.getServerTable().saveCurrentServerInfo(new ServerInfo(-1, TestInit.getServerUUID(), "ServerName", "", 20));
|
||||
|
||||
File f = new File(plan.getDataFolder(), "Errors.txt");
|
||||
rows = FileUtil.lines(f).size();
|
||||
@ -609,7 +609,7 @@ public class DatabaseTest {
|
||||
assertFalse(bungeeInfo.isPresent());
|
||||
|
||||
UUID bungeeUUID = UUID.randomUUID();
|
||||
ServerInfo bungeeCord = new ServerInfo(-1, bungeeUUID, "BungeeCord", "Random:1234");
|
||||
ServerInfo bungeeCord = new ServerInfo(-1, bungeeUUID, "BungeeCord", "Random:1234", 20);
|
||||
serverTable.saveCurrentServerInfo(bungeeCord);
|
||||
|
||||
bungeeCord.setId(2);
|
||||
|
@ -157,7 +157,7 @@ public class MiscUtilsTest {
|
||||
db = new SQLiteDB(plan, "debug" + MiscUtils.getTime());
|
||||
db.init();
|
||||
|
||||
db.getServerTable().saveCurrentServerInfo(new ServerInfo(-1, TestInit.getServerUUID(), "ServerName", ""));
|
||||
db.getServerTable().saveCurrentServerInfo(new ServerInfo(-1, TestInit.getServerUUID(), "ServerName", "", 20));
|
||||
|
||||
when(plan.getDB()).thenReturn(db);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user