Added config settings for ping delays #691

This commit is contained in:
Rsl1122 2018-08-21 09:46:43 +03:00
parent d587892df2
commit 268474d5ca
6 changed files with 17 additions and 3 deletions

View File

@ -52,6 +52,8 @@ public enum Settings {
AFK_THRESHOLD_MINUTES("Data.AFKThresholdMinutes"),
KEEP_LOGS_DAYS("Plugin.KeepLogsForXDays"),
KEEP_INACTIVE_PLAYERS_DAYS("Data.KeepInactivePlayerDataForDays"),
PING_SERVER_ENABLE_DELAY("Data.Ping.ServerEnableDelaySeconds"),
PING_PLAYER_LOGIN_DELAY("Data.Ping.PlayerLoginDelaySeconds"),
// String
DEBUG("Plugin.Debug"),

View File

@ -174,7 +174,9 @@ public class NetworkSettings {
AFK_THRESHOLD_MINUTES,
DATA_GEOLOCATIONS,
KEEP_LOGS_DAYS,
KEEP_INACTIVE_PLAYERS_DAYS
KEEP_INACTIVE_PLAYERS_DAYS,
PING_SERVER_ENABLE_DELAY,
PING_PLAYER_LOGIN_DELAY
};
Log.debug("NetworkSettings: Adding Config Values..");
for (Settings setting : sameStrings) {

View File

@ -5,10 +5,12 @@
package com.djrapitops.plan.system.tasks;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.system.tasks.server.BukkitTPSCountTimer;
import com.djrapitops.plan.system.tasks.server.PaperTPSCountTimer;
import com.djrapitops.plan.system.tasks.server.PingCountTimer;
import com.djrapitops.plugin.api.Check;
import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.task.RunnableFactory;
import org.bukkit.Bukkit;
@ -33,8 +35,9 @@ public class BukkitTaskSystem extends ServerTaskSystem {
try {
PingCountTimer pingCountTimer = new PingCountTimer();
((Plan) plugin).registerListener(pingCountTimer);
long startDelay = TimeAmount.SECOND.ms() * (long) Settings.PING_SERVER_ENABLE_DELAY.getNumber();
RunnableFactory.createNew("PingCountTimer", pingCountTimer)
.runTaskTimer(20L, PingCountTimer.PING_INTERVAL);
.runTaskTimer(startDelay, PingCountTimer.PING_INTERVAL);
} catch (ExceptionInInitializerError | NoClassDefFoundError ignore) {
// Running CraftBukkit
}

View File

@ -26,6 +26,7 @@ package com.djrapitops.plan.system.tasks.server;
import com.djrapitops.plan.data.store.objects.DateObj;
import com.djrapitops.plan.system.processing.Processing;
import com.djrapitops.plan.system.processing.processors.player.PingInsertProcessor;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.utilities.java.Reflection;
import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.api.utility.log.Log;
@ -160,7 +161,7 @@ public class PingCountTimer extends AbsRunnable implements Listener {
addPlayer(player);
}
}
}).runTaskLater(TimeAmount.SECOND.ticks() * 15L);
}).runTaskLater(TimeAmount.SECOND.ticks() * (long) Settings.PING_PLAYER_LOGIN_DELAY.getNumber());
}
@EventHandler

View File

@ -67,6 +67,9 @@ Data:
LogUnknownCommands: false
CombineCommandAliases: true
Geolocations: true
Ping:
ServerEnableDelaySeconds: 300
PlayerLoginDelaySeconds: 30
KeepInactivePlayerDataForDays: 180
# -----------------------------------------------------
Customization:

View File

@ -81,6 +81,9 @@ Data:
LogUnknownCommands: false
CombineCommandAliases: true
Geolocations: true
Ping:
ServerEnableDelaySeconds: 300
PlayerLoginDelaySeconds: 30
KeepInactivePlayerDataForDays: 180
# -----------------------------------------------------
Customization: