SteamWar/FightSystem
Archiviert
13
1

Merge pull request 'added arena afk stopper' (#372) from afk_stopper into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #372
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2023-01-22 21:08:53 +01:00
Commit eaf4305bd9
3 geänderte Dateien mit 5 neuen und 20 gelöschten Zeilen

Datei anzeigen

@ -20,7 +20,7 @@ Ranks: [] # Disables ranks for this schematic type if missing
Times:
# Time in seconds the server stops after starting if nobody joins
NoPlayersOnlineDuration: 30 # defaults to 30 if missing
NoPlayersOnlineDuration: 300 # defaults to 300 if missing
# Time in seconds the team leaders have to choose their schematic
PreSchemPasteDuration: 120 # defaults to 120 if missing
# Time in seconds for preparing

Datei anzeigen

@ -155,7 +155,7 @@ public class Config {
}
FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile);
NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration", 30);
NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration", 300);
PreSchemPasteDuration = config.getInt("Times.PreSchemPasteDuration", 120);
SetupDuration = config.getInt("Times.SetupDuration", 300);
PreFightDuration = config.getInt("Times.PreFightDuration", 30);

Datei anzeigen

@ -23,31 +23,16 @@ import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.Message;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class NoPlayersOnlineCountdown extends Countdown implements Listener {
public class NoPlayersOnlineCountdown extends Countdown {
public NoPlayersOnlineCountdown() {
super(Config.NoPlayerOnlineDuration, new Message("SHUTDOWN_COUNTDOWN"), null, false);
new StateDependentListener(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this);
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this) {
@Override
public void enable() {
if(Bukkit.getOnlinePlayers().isEmpty())
super.enable();
}
};
}
@EventHandler
public void handlePlayerJoin(PlayerJoinEvent event) {
disable();
if (!Config.ArenaLeaveable)
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this);
}
@Override