added arena afk stopper #372
@ -20,7 +20,7 @@ Ranks: [] # Disables ranks for this schematic type if missing
|
|||||||
|
|
||||||
Times:
|
Times:
|
||||||
# Time in seconds the server stops after starting if nobody joins
|
# 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
|
# Time in seconds the team leaders have to choose their schematic
|
||||||
PreSchemPasteDuration: 120 # defaults to 120 if missing
|
PreSchemPasteDuration: 120 # defaults to 120 if missing
|
||||||
# Time in seconds for preparing
|
# Time in seconds for preparing
|
||||||
|
@ -155,7 +155,7 @@ public class Config {
|
|||||||
}
|
}
|
||||||
FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile);
|
FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile);
|
||||||
|
|
||||||
NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration", 30);
|
NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration", 300);
|
||||||
PreSchemPasteDuration = config.getInt("Times.PreSchemPasteDuration", 120);
|
PreSchemPasteDuration = config.getInt("Times.PreSchemPasteDuration", 120);
|
||||||
SetupDuration = config.getInt("Times.SetupDuration", 300);
|
SetupDuration = config.getInt("Times.SetupDuration", 300);
|
||||||
PreFightDuration = config.getInt("Times.PreFightDuration", 30);
|
PreFightDuration = config.getInt("Times.PreFightDuration", 30);
|
||||||
|
@ -23,31 +23,16 @@ import de.steamwar.fightsystem.ArenaMode;
|
|||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
import de.steamwar.fightsystem.states.StateDependentCountdown;
|
import de.steamwar.fightsystem.states.StateDependentCountdown;
|
||||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
|
||||||
import de.steamwar.fightsystem.utils.Message;
|
import de.steamwar.fightsystem.utils.Message;
|
||||||
import org.bukkit.Bukkit;
|
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() {
|
public NoPlayersOnlineCountdown() {
|
||||||
super(Config.NoPlayerOnlineDuration, new Message("SHUTDOWN_COUNTDOWN"), null, false);
|
super(Config.NoPlayerOnlineDuration, new Message("SHUTDOWN_COUNTDOWN"), null, false);
|
||||||
|
|
||||||
new StateDependentListener(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this);
|
if (!Config.ArenaLeaveable)
|
||||||
new StateDependentCountdown(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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren