fix afk time
This commit is contained in:
@ -49,6 +49,7 @@ public final class popa extends JavaPlugin implements Listener {
|
|||||||
private String inventoryRequestsUrl;
|
private String inventoryRequestsUrl;
|
||||||
private String marketplaceUrl;
|
private String marketplaceUrl;
|
||||||
private String bonusesUrl;
|
private String bonusesUrl;
|
||||||
|
private int afkTimeoutSeconds;
|
||||||
private final Map<UUID, Long> playerLoginTimes = new HashMap<>();
|
private final Map<UUID, Long> playerLoginTimes = new HashMap<>();
|
||||||
private final Map<UUID, String> playerNames = new HashMap<>();
|
private final Map<UUID, String> playerNames = new HashMap<>();
|
||||||
private ScheduledExecutorService scheduler;
|
private ScheduledExecutorService scheduler;
|
||||||
@ -61,6 +62,8 @@ public final class popa extends JavaPlugin implements Listener {
|
|||||||
saveDefaultConfig();
|
saveDefaultConfig();
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
|
|
||||||
|
afkTimeoutSeconds = getConfig().getInt("afk-timeout-seconds", 300);
|
||||||
|
|
||||||
// База для всех урлов
|
// База для всех урлов
|
||||||
apiBase = getConfig().getString("api-base", "http://localhost:8000");
|
apiBase = getConfig().getString("api-base", "http://localhost:8000");
|
||||||
|
|
||||||
@ -284,7 +287,7 @@ public final class popa extends JavaPlugin implements Listener {
|
|||||||
long inactiveSeconds = (currentTime - lastActivity) / 1000;
|
long inactiveSeconds = (currentTime - lastActivity) / 1000;
|
||||||
|
|
||||||
// Больше минуты не двигался — не отправляем в список активных
|
// Больше минуты не двигался — не отправляем в список активных
|
||||||
if (inactiveSeconds > 60) {
|
if (inactiveSeconds > afkTimeoutSeconds) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,8 @@ api-base: "http://localhost:3001"
|
|||||||
# IP сервера (оставьте пустым для автоматического определения)
|
# IP сервера (оставьте пустым для автоматического определения)
|
||||||
server-ip: "minecraft.hub.popa-popa.ru"
|
server-ip: "minecraft.hub.popa-popa.ru"
|
||||||
|
|
||||||
|
afk-timeout-seconds: 300
|
||||||
|
|
||||||
# Интервалы обновления (в секундах)
|
# Интервалы обновления (в секундах)
|
||||||
commands-interval-seconds: 5 # проверка команд
|
commands-interval-seconds: 5 # проверка команд
|
||||||
inventory-interval-seconds: 5 # запросы инвентаря
|
inventory-interval-seconds: 5 # запросы инвентаря
|
||||||
|
|||||||
Reference in New Issue
Block a user