Fix compile issues, Added player counts to analysis page

This commit is contained in:
Rsl1122 2017-09-01 17:32:06 +03:00
parent 63749b913a
commit 1d4f3237b8
3 changed files with 15 additions and 3 deletions

View File

@ -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();
}
}

View File

@ -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);

View File

@ -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);
}