mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-04-24 18:40:34 +08:00
Added Max players scale disable option.
This commit is contained in:
parent
d4ff5dd899
commit
1ce28cc486
Plan/src/main
java/com/djrapitops/plan
resources
@ -40,6 +40,7 @@ import main.java.com.djrapitops.plan.ui.Html;
|
||||
import main.java.com.djrapitops.plan.ui.webserver.WebSocketServer;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@ -82,7 +83,14 @@ public class Plan extends JavaPlugin {
|
||||
|
||||
initLocale();
|
||||
|
||||
variable = new ServerVariableHolder(this);
|
||||
Server server = getServer();
|
||||
variable = new ServerVariableHolder(server);
|
||||
|
||||
Log.debug("-------------------------------------");
|
||||
Log.debug("Debug log, Server Start: Plan v."+getDescription().getVersion());
|
||||
Log.debug("Server: "+server.getBukkitVersion()+" | V."+server.getVersion());
|
||||
Log.debug("Version: "+server.getVersion());
|
||||
Log.debug("-------------------------------------");
|
||||
|
||||
databases = new HashSet<>();
|
||||
databases.add(new MySQLDB(this));
|
||||
@ -99,7 +107,7 @@ public class Plan extends JavaPlugin {
|
||||
Log.info(Phrase.DB_ESTABLISHED.parse(db.getConfigName()));
|
||||
} else {
|
||||
Log.error(Phrase.DB_FAILURE_DISABLE.toString());
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
server.getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -128,13 +136,13 @@ public class Plan extends JavaPlugin {
|
||||
|| (Settings.USE_ALTERNATIVE_UI.isTrue())) {
|
||||
Log.infoColor(Phrase.ERROR_NO_DATA_VIEW + "");
|
||||
}
|
||||
if (!Settings.SHOW_ALTERNATIVE_IP.isTrue() && getServer().getIp().isEmpty()) {
|
||||
if (!Settings.SHOW_ALTERNATIVE_IP.isTrue() && server.getIp().isEmpty()) {
|
||||
Log.infoColor(Phrase.NOTIFY_EMPTY_IP + "");
|
||||
}
|
||||
|
||||
hookHandler = new HookHandler();
|
||||
|
||||
Log.debug("Verboose debug messages are enabled.");
|
||||
Log.debug("Verboose debug messages are enabled.");
|
||||
Log.info(Phrase.ENABLED + "");
|
||||
}
|
||||
|
||||
|
@ -1,20 +1,21 @@
|
||||
package main.java.com.djrapitops.plan;
|
||||
|
||||
import org.bukkit.Server;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class ServerVariableHolder {
|
||||
|
||||
|
||||
private int maxPlayers;
|
||||
|
||||
public ServerVariableHolder(Plan plugin) {
|
||||
maxPlayers = plugin.getServer().getMaxPlayers();
|
||||
public ServerVariableHolder(Server server) {
|
||||
maxPlayers = server.getMaxPlayers();
|
||||
}
|
||||
|
||||
public int getMaxPlayers() {
|
||||
return maxPlayers;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ public enum Settings {
|
||||
GATHERGMTIMES("Settings.Data.GamemodeChangeListener"),
|
||||
GATHERCOMMANDS("Settings.Data.GatherCommandUsage"),
|
||||
SECURITY_IP_UUID("Settings.WebServer.Security.DisplayIPsAndUUIDs"),
|
||||
GRAPH_PLAYERS_USEMAXPLAYERS_SCALE("Customization.Graphs.PlayersOnlineGraph.UseMaxPlayersAsScale"),
|
||||
ENABLED_AA("Customization.Plugins.Enabled.AdvancedAchievements"),
|
||||
ENABLED_ESS("Customization.Plugins.Enabled.Essentials"),
|
||||
ENABLED_FAC("Customization.Plugins.Enabled.Factions"),
|
||||
|
@ -6,6 +6,7 @@ import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
import main.java.com.djrapitops.plan.ui.DataRequestHandler;
|
||||
import main.java.com.djrapitops.plan.utilities.Benchmark;
|
||||
import main.java.com.djrapitops.plan.utilities.uuid.UUIDUtility;
|
||||
|
||||
/**
|
||||
@ -36,14 +37,17 @@ public class Response {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void sendStaticResource() throws IOException {
|
||||
Benchmark.start("Webserver Response");
|
||||
try {
|
||||
if (request == null) {
|
||||
return;
|
||||
}
|
||||
if (request.getUri() == null) {
|
||||
String requestUri = request.getUri();
|
||||
if (requestUri == null) {
|
||||
return;
|
||||
}
|
||||
String[] requestArgs = request.getUri().split("/");
|
||||
Log.debug("Request: " + requestUri);
|
||||
String[] requestArgs = requestUri.split("/");
|
||||
boolean forbidden = false;
|
||||
String securityCode = "";
|
||||
if (requestArgs.length <= 2) {
|
||||
@ -116,6 +120,8 @@ public class Response {
|
||||
output.write(errorMessage.getBytes());
|
||||
} catch (Exception e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
} finally {
|
||||
Benchmark.stop("Webserver Response");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ public class PlaceholderUtils {
|
||||
replaceMap.put("#" + defaultCols[i], "#" + colors[i]);
|
||||
}
|
||||
}
|
||||
replaceMap.put("%graphmaxplayers%", plugin.getVariable().getMaxPlayers()+"");
|
||||
replaceMap.put("%graphmaxplayers%", Settings.GRAPH_PLAYERS_USEMAXPLAYERS_SCALE.isTrue() ? plugin.getVariable().getMaxPlayers()+"" : "2");
|
||||
replaceMap.put("%refreshlong%", data.getRefreshDate()+"");
|
||||
replaceMap.put("%servername%", Settings.SERVER_NAME.toString());
|
||||
Benchmark.stop("Replace Placeholders Anaysis");
|
||||
|
@ -41,6 +41,9 @@ Settings:
|
||||
|
||||
Customization:
|
||||
ServerName: 'Plan'
|
||||
Graphs:
|
||||
PlayersOnlineGraph:
|
||||
UseMaxPlayersAsScale: true
|
||||
Formats:
|
||||
TimeAmount:
|
||||
Year: '1 year, '
|
||||
|
Loading…
x
Reference in New Issue
Block a user