Made it possible to disable stat-request-limiting in the config

This commit is contained in:
Artemis-the-gr8 2022-07-06 21:43:24 +02:00
parent fac5ee0a6b
commit ce6a1d0dab
3 changed files with 9 additions and 1 deletions

View File

@ -57,7 +57,7 @@ public class ThreadManager {
statThreadID += 1; statThreadID += 1;
String cmdSender = request.getCommandSender().getName(); String cmdSender = request.getCommandSender().getName();
if (statThreads.containsKey(cmdSender)) { if (config.limitStatRequests() && statThreads.containsKey(cmdSender)) {
Thread runningThread = statThreads.get(cmdSender); Thread runningThread = statThreads.get(cmdSender);
if (runningThread.isAlive()) { if (runningThread.isAlive()) {
adventure.sender(request.getCommandSender()).sendMessage(messageWriter.requestAlreadyRunning(request.isBukkitConsoleSender())); adventure.sender(request.getCommandSender()).sendMessage(messageWriter.requestAlreadyRunning(request.isBukkitConsoleSender()));

View File

@ -73,6 +73,10 @@ public class ConfigHandler {
return config.getInt("debug-level", 1); return config.getInt("debug-level", 1);
} }
public boolean limitStatRequests() {
return config.getBoolean("only-allow-one-lookup-at-a-time-per-player", true);
}
/** Returns the config setting for include-whitelist-only. /** Returns the config setting for include-whitelist-only.
<p>Default: false</p>*/ <p>Default: false</p>*/
public boolean whitelistOnly() { public boolean whitelistOnly() {

View File

@ -14,6 +14,10 @@ config-version: 5
# 3 = high (log all tasks and time taken) # 3 = high (log all tasks and time taken)
debug-level: 1 debug-level: 1
# Whether players have to wait for their lookup to finish before they can request another statistic
# Warning: disabling this could allow players to stress out your server by spamming the stat-command!
only-allow-one-lookup-at-a-time-per-player: true
# Filtering options to control which players should be included in statistic calculations # Filtering options to control which players should be included in statistic calculations
include-whitelist-only: false include-whitelist-only: false
exclude-banned-players: false exclude-banned-players: false