mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 19:25:15 +01:00
Add 'fullrenderplayerlimit' - pause fullrender when number of active players reaches optional limit, resumes after
This commit is contained in:
parent
de6b90784f
commit
19f9733aab
@ -82,6 +82,8 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
boolean fencejoin = false;
|
||||
public CompassMode compassmode = CompassMode.PRE19;
|
||||
private int config_hashcode; /* Used to signal need to reload web configuration (world changes, config update, etc) */
|
||||
private int fullrenderplayerlimit; /* Number of online players that will cause fullrender processing to pause */
|
||||
private boolean didfullpause;
|
||||
|
||||
public enum CompassMode {
|
||||
PRE19, /* Default for 1.8 and earlier (east is Z+) */
|
||||
@ -272,6 +274,8 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
compassmode = CompassMode.NEWROSE;
|
||||
else
|
||||
compassmode = CompassMode.PRE19;
|
||||
/* Load full render processing player limit */
|
||||
fullrenderplayerlimit = configuration.getInteger("fullrenderplayerlimit", 0);
|
||||
|
||||
loadDebuggers();
|
||||
|
||||
@ -285,9 +289,27 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
PlayerListener pl = new PlayerListener() {
|
||||
public void onPlayerJoin(PlayerJoinEvent evt) {
|
||||
playerList.updateOnlinePlayers(null);
|
||||
if(fullrenderplayerlimit > 0) {
|
||||
if((getServer().getOnlinePlayers().length+1) >= fullrenderplayerlimit) {
|
||||
if(getPauseFullRadiusRenders() == false) { /* If not paused, pause it */
|
||||
setPauseFullRadiusRenders(true);
|
||||
Log.info("Pause full/radius renders - player limit reached");
|
||||
didfullpause = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onPlayerQuit(PlayerQuitEvent evt) {
|
||||
playerList.updateOnlinePlayers(evt.getPlayer());
|
||||
if(fullrenderplayerlimit > 0) {
|
||||
if((getServer().getOnlinePlayers().length-1) < fullrenderplayerlimit) {
|
||||
if(didfullpause) { /* Only unpause if we did the pause */
|
||||
setPauseFullRadiusRenders(false);
|
||||
Log.info("Resume full/radius renders - below player limit");
|
||||
didfullpause = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
registerEvent(Type.PLAYER_JOIN, pl);
|
||||
|
@ -223,6 +223,9 @@ progressloginterval: 100
|
||||
# Interval the browser should poll for updates.
|
||||
updaterate: 2000
|
||||
|
||||
# If nonzero, server will pause fullrender/radiusrender processing when 'fullrenderplayerlimit' or more user's are logged in
|
||||
fullrenderplayerlimit: 0
|
||||
|
||||
showplayerfacesinmenu: true
|
||||
|
||||
# Set sidebaropened: 'true' to pin menu sidebar opened permanently, 'pinned' to default the sidebar to pinned, but allow it to unpin
|
||||
|
Loading…
Reference in New Issue
Block a user