diff --git a/FightSystem_API/src/de/steamwar/fightsystem/Config.java b/FightSystem_API/src/de/steamwar/fightsystem/Config.java index 02249f5..aa0782d 100644 --- a/FightSystem_API/src/de/steamwar/fightsystem/Config.java +++ b/FightSystem_API/src/de/steamwar/fightsystem/Config.java @@ -18,11 +18,14 @@ public class Config { private Config(){} - //Fight sequence durations + //Fight sequence public static final int NoPlayerOnlineDuration; + public static final int PreSchemPasteDuration; public static final int SetupDuration; public static final int PreFightDuration; + public static final int EnterPhaseBegin; public static final int SpectatorDuration; + public static final boolean Entern; //arena parameter public static final int SchemsizeX; @@ -82,14 +85,12 @@ public class Config { public static final boolean PercentSystem; public static final boolean RelativePercent; public static final boolean Points; - public static final boolean Entern; public static final boolean TechKO; public static final boolean WaterTechKO; public static final boolean PumpkinTechKO; //win condition parameters public static final int TimeoutTime; - public static final int EnterPhaseBegin; public static final double PercentWin; public static final List IgnoredBlocks; @@ -126,6 +127,7 @@ public class Config { FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile); NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration"); + PreSchemPasteDuration = config.getInt("Times.PreSchemPasteDuration"); SetupDuration = config.getInt("Times.SetupDuration"); PreFightDuration = config.getInt("Times.PreFightDuration"); SpectatorDuration = config.getInt("Times.SpectatorDuration"); diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java index 6944b43..8664927 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java @@ -108,7 +108,7 @@ public class FightSystem extends JavaPlugin { throw new SecurityException(fightState.name()); setFightState(FightState.PRE_SCHEM_SETUP); - mainCountdown = new SetupOverCountdown(); + mainCountdown = new PreSchemPasteCountdown(); } public static void setPostSchemState() { @@ -275,8 +275,10 @@ public class FightSystem extends JavaPlugin { private static void setFightState(FightState state){ fightState = state; - if(mainCountdown != null) + if(mainCountdown != null){ mainCountdown.disable(); + mainCountdown = null; + } postStateChange(); } diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/countdown/PreSchemPasteCountdown.java b/FightSystem_Main/src/de/steamwar/fightsystem/countdown/PreSchemPasteCountdown.java new file mode 100644 index 0000000..078bfd1 --- /dev/null +++ b/FightSystem_Main/src/de/steamwar/fightsystem/countdown/PreSchemPasteCountdown.java @@ -0,0 +1,30 @@ +package de.steamwar.fightsystem.countdown; + +import de.steamwar.fightsystem.Config; +import de.steamwar.fightsystem.FightSystem; +import de.steamwar.fightsystem.fight.Fight; +import de.steamwar.fightsystem.fight.FightTeam; + +public class PreSchemPasteCountdown extends Countdown { + + public PreSchemPasteCountdown() { + super(Config.PreSchemPasteDuration, SWSound.BLOCK_NOTE_PLING, false); + } + + @Override + String countdownCounting() { + return "bis eine Public-Schematic gewählt wird!"; + } + + @Override + void countdownFinished() { + checkTeam(Fight.getBlueTeam()); + checkTeam(Fight.getRedTeam()); + FightSystem.setPostSchemState(); + } + + private void checkTeam(FightTeam team){ + if(!team.hasSchematic()) + team.pasteDummy(); + } +} diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java b/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java index 1bebc3c..b6f4228 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java @@ -271,6 +271,9 @@ public class FightTeam implements IFightTeam{ schematic = publics.get(new Random().nextInt(publics.size())); pasteSchematic(); + + if(!Config.test() && leader != null) + leader.getPlayer().getInventory().clear(0); } public void setSchematic(Schematic schematic){