diff --git a/src/main/java/net/countercraft/movecraft/warfare/features/siege/SiegeConfig.java b/src/main/java/net/countercraft/movecraft/warfare/features/siege/SiegeConfig.java index 7ba93ef..00affb5 100644 --- a/src/main/java/net/countercraft/movecraft/warfare/features/siege/SiegeConfig.java +++ b/src/main/java/net/countercraft/movecraft/warfare/features/siege/SiegeConfig.java @@ -10,7 +10,7 @@ public class SiegeConfig { @NotNull private final String captureRegion; @NotNull private final List daysOfWeek; @NotNull private final List craftsToWin, commandsOnStart, commandsOnWin, commandsOnLose; - private final int scheduleStart, scheduleEnd, delayBeforeStart, duration, dailyIncome, cost; + private final int scheduleStart, scheduleEnd, delayBeforeStart, duration, dailyIncome, cost, suddenDeathDuration; private final boolean doubleCostPerOwnedSiegeRegion; public SiegeConfig(ConfigurationSection config) { @@ -61,6 +61,16 @@ public SiegeConfig(ConfigurationSection config) { if(!config.isBoolean("DoubleCostPerOwnedSiegeRegion")) throw new IllegalArgumentException("Invalid DoubleCostPerOwnedSiegeRegion"); doubleCostPerOwnedSiegeRegion = config.getBoolean("DoubleCostPerOwnedSiegeRegion"); + + // Since this is a new addition to the siege file and optional, + // get it if present but ignore it if not + if (config.contains("SiegeSuddenDeathDuration")) { + if(!config.isInt("SiegeSuddenDeathDuration")) + throw new IllegalArgumentException("Invalid SiegeSuddenDeathDuration"); + suddenDeathDuration = config.getInt("SiegeSuddenDeathDuration"); + } else { + suddenDeathDuration = 0; + } } @NotNull @@ -122,6 +132,10 @@ public int getCost() { return cost; } + public int getSuddenDeathDuration() { + return suddenDeathDuration; + } + public boolean isDoubleCostPerOwnedSiegeRegion() { return doubleCostPerOwnedSiegeRegion; }