added arena afk stopper #372
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren