Skip to content

Commit

Permalink
TopNPlayer: Task could not startup if ranks are enabled but there are…
Browse files Browse the repository at this point in the history
… no default ranks.

Log a message in the console that the task cannot start because ranks are enabled and there are no ranks.
Request that Ranks module is disabled, or add default ranks and then restart the server.
  • Loading branch information
rbluer committed Sep 24, 2023
1 parent bd8a092 commit 0fc3e6c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
7 changes: 6 additions & 1 deletion docs/changelog_v3.3.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ These change logs represent the work that has been going on within prison.
* **Changed the default color code from `&9` (dark blue) to `&b` (light blue) for debug logging since the dark blue could be difficult to see on some consoles.


**v3.3.0-alpha.15f 2023-09-23**
**v3.3.0-alpha.15f 2023-09-24**


* **TopNPlayer: Task could not startup if ranks are enabled but there are no default ranks.**
Log a message in the console that the task cannot start because ranks are enabled and there are no ranks.
Request that Ranks module is disabled, or add default ranks and then restart the server.


* **Prison Support: Added a more secure method and server (privatebin) for submitting server information under prison support submit commands.**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import tech.mcprison.prison.file.FileIOData;
import tech.mcprison.prison.file.JsonFileIO;
import tech.mcprison.prison.internal.Player;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.ranks.PrisonRanks;
import tech.mcprison.prison.ranks.tasks.TopNPlayerUpdateAsyncTask;

Expand Down Expand Up @@ -132,7 +133,9 @@ private void launchTopNPlayerUpdateAsyncTask() {

if ( PrisonRanks.getInstance() != null &&
PrisonRanks.getInstance().isEnabled() &&
PrisonRanks.getInstance().getPlayerManager() != null ) {
PrisonRanks.getInstance().getPlayerManager() != null &&
PrisonRanks.getInstance().getDefaultLadder().getRanks().size() > 0
) {

Long delayTicks = Prison.get().getPlatform().getConfigLong(
"topNPlayers.refresh.delay-ticks", DELAY_THIRTY_SECONDS_TICKS );
Expand All @@ -142,6 +145,15 @@ private void launchTopNPlayerUpdateAsyncTask() {

TopNPlayerUpdateAsyncTask.submitTaskTimerAsync( this, delayTicks, intervalTicks );
}
else if ( PrisonRanks.getInstance() != null &&
PrisonRanks.getInstance().isEnabled() &&
PrisonRanks.getInstance().getDefaultLadder().getRanks().size() == 0 ) {

Output.get().logWarn( "TopNPlayer: Cannot start the TopNPlayer task. Ranks are "
+ "enabled, but there are no default ranks setup. "
+ "Either turn off the Ranks Module, or add ranks and "
+ "then restart the server to get the TopNPlayer task running.");
}

}

Expand Down

0 comments on commit 0fc3e6c

Please sign in to comment.