diff --git a/src/main/java/com/github/alathra/AlathranWars/AlathranWars.java b/src/main/java/com/github/alathra/AlathranWars/AlathranWars.java index be88744..8616248 100644 --- a/src/main/java/com/github/alathra/AlathranWars/AlathranWars.java +++ b/src/main/java/com/github/alathra/AlathranWars/AlathranWars.java @@ -2,7 +2,7 @@ package com.github.alathra.AlathranWars; import com.github.alathra.AlathranWars.commands.CommandManager; import com.github.alathra.AlathranWars.config.ConfigHandler; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.db.DatabaseHandler; import com.github.alathra.AlathranWars.db.DatabaseQueries; import com.github.alathra.AlathranWars.hooks.HookManager; diff --git a/src/main/java/com/github/alathra/AlathranWars/commands/CommandUtil.java b/src/main/java/com/github/alathra/AlathranWars/commands/CommandUtil.java index a5df393..fa9669c 100644 --- a/src/main/java/com/github/alathra/AlathranWars/commands/CommandUtil.java +++ b/src/main/java/com/github/alathra/AlathranWars/commands/CommandUtil.java @@ -1,9 +1,9 @@ package com.github.alathra.AlathranWars.commands; import com.github.alathra.AlathranWars.AlathranWars; -import com.github.alathra.AlathranWars.conflict.Side; -import com.github.alathra.AlathranWars.conflict.War; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.side.Side; +import com.github.alathra.AlathranWars.conflict.war.War; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; import com.github.alathra.AlathranWars.enums.CommandArgsSiege; import com.github.alathra.AlathranWars.enums.CommandArgsWar; diff --git a/src/main/java/com/github/alathra/AlathranWars/commands/SiegeCommands.java b/src/main/java/com/github/alathra/AlathranWars/commands/SiegeCommands.java index 5cd9446..98ab697 100644 --- a/src/main/java/com/github/alathra/AlathranWars/commands/SiegeCommands.java +++ b/src/main/java/com/github/alathra/AlathranWars/commands/SiegeCommands.java @@ -1,9 +1,9 @@ package com.github.alathra.AlathranWars.commands; import com.github.alathra.AlathranWars.AlathranWars; -import com.github.alathra.AlathranWars.conflict.Side; -import com.github.alathra.AlathranWars.conflict.War; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.side.Side; +import com.github.alathra.AlathranWars.conflict.war.War; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; import com.github.alathra.AlathranWars.enums.battle.BattleVictoryReason; import com.github.alathra.AlathranWars.utility.UtilsChat; diff --git a/src/main/java/com/github/alathra/AlathranWars/commands/WarCommands.java b/src/main/java/com/github/alathra/AlathranWars/commands/WarCommands.java index 20deb58..8a82847 100644 --- a/src/main/java/com/github/alathra/AlathranWars/commands/WarCommands.java +++ b/src/main/java/com/github/alathra/AlathranWars/commands/WarCommands.java @@ -1,6 +1,10 @@ package com.github.alathra.AlathranWars.commands; -import com.github.alathra.AlathranWars.conflict.*; +import com.github.alathra.AlathranWars.conflict.war.War; +import com.github.alathra.AlathranWars.conflict.war.WarBuilder; +import com.github.alathra.AlathranWars.conflict.war.WarController; +import com.github.alathra.AlathranWars.conflict.war.side.Side; +import com.github.alathra.AlathranWars.conflict.war.side.SideCreationException; import com.github.alathra.AlathranWars.hooks.NameColorHandler; import com.github.alathra.AlathranWars.utility.UtilsChat; import com.github.milkdrinkers.colorparser.ColorParser; diff --git a/src/main/java/com/github/alathra/AlathranWars/conflict/battle/raid/Raid.java b/src/main/java/com/github/alathra/AlathranWars/conflict/battle/raid/Raid.java index 0a8b38d..c71b164 100644 --- a/src/main/java/com/github/alathra/AlathranWars/conflict/battle/raid/Raid.java +++ b/src/main/java/com/github/alathra/AlathranWars/conflict/battle/raid/Raid.java @@ -1,8 +1,8 @@ package com.github.alathra.AlathranWars.conflict.battle.raid; import com.github.alathra.AlathranWars.AlathranWars; -import com.github.alathra.AlathranWars.conflict.Side; -import com.github.alathra.AlathranWars.conflict.War; +import com.github.alathra.AlathranWars.conflict.war.side.Side; +import com.github.alathra.AlathranWars.conflict.war.War; import com.github.alathra.AlathranWars.conflict.battle.Battle; import com.github.alathra.AlathranWars.enums.CaptureProgressDirection; import com.github.alathra.AlathranWars.enums.battle.*; diff --git a/src/main/java/com/github/alathra/AlathranWars/conflict/battle/siege/Siege.java b/src/main/java/com/github/alathra/AlathranWars/conflict/battle/siege/Siege.java index eebc3f6..a9baa8d 100644 --- a/src/main/java/com/github/alathra/AlathranWars/conflict/battle/siege/Siege.java +++ b/src/main/java/com/github/alathra/AlathranWars/conflict/battle/siege/Siege.java @@ -1,8 +1,8 @@ package com.github.alathra.AlathranWars.conflict.battle.siege; import com.github.alathra.AlathranWars.AlathranWars; -import com.github.alathra.AlathranWars.conflict.Side; -import com.github.alathra.AlathranWars.conflict.War; +import com.github.alathra.AlathranWars.conflict.war.side.Side; +import com.github.alathra.AlathranWars.conflict.war.War; import com.github.alathra.AlathranWars.conflict.battle.Battle; import com.github.alathra.AlathranWars.db.DatabaseQueries; import com.github.alathra.AlathranWars.enums.CaptureProgressDirection; diff --git a/src/main/java/com/github/alathra/AlathranWars/conflict/War.java b/src/main/java/com/github/alathra/AlathranWars/conflict/war/War.java similarity index 97% rename from src/main/java/com/github/alathra/AlathranWars/conflict/War.java rename to src/main/java/com/github/alathra/AlathranWars/conflict/war/War.java index 80ac95a..217293b 100644 --- a/src/main/java/com/github/alathra/AlathranWars/conflict/War.java +++ b/src/main/java/com/github/alathra/AlathranWars/conflict/war/War.java @@ -1,7 +1,11 @@ -package com.github.alathra.AlathranWars.conflict; +package com.github.alathra.AlathranWars.conflict.war; +import com.github.alathra.AlathranWars.conflict.*; import com.github.alathra.AlathranWars.conflict.battle.raid.Raid; import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; +import com.github.alathra.AlathranWars.conflict.war.side.Side; +import com.github.alathra.AlathranWars.conflict.war.side.SideBuilder; +import com.github.alathra.AlathranWars.conflict.war.side.SideCreationException; import com.github.alathra.AlathranWars.db.DatabaseQueries; import com.github.alathra.AlathranWars.enums.ConflictType; import com.github.alathra.AlathranWars.enums.WarDeleteReason; @@ -47,7 +51,7 @@ public class War extends Conflict { private final ConflictType conflictType = ConflictType.WAR; private boolean event; - private @NotNull Side side1; + private Side side1; private Side side2; private final Side attacker; // Reference variable to side1 or side2 private final Side defender; // Reference variable to side1 or side2 @@ -72,7 +76,7 @@ public class War extends Conflict { UUID uuid, String name, String label, - @NotNull Side side1, + Side side1, Side side2, Set sieges, Set raids, @@ -127,14 +131,14 @@ public class War extends Conflict { .setLeader(aggressor) .setSide(BattleSide.ATTACKER) .setTeam(BattleTeam.SIDE_1) - .buildNew(); + .build(); this.side2 = new SideBuilder() .setWarUUID(this.uuid) .setUuid(UUID.randomUUID()) .setLeader(victim) .setSide(BattleSide.DEFENDER) .setTeam(BattleTeam.SIDE_2) - .buildNew(); + .build(); this.attacker = side1.getSide().equals(BattleSide.ATTACKER) ? this.side1 : this.side2; this.defender = side1.getSide().equals(BattleSide.DEFENDER) ? this.side1 : this.side2; @@ -196,7 +200,7 @@ public class War extends Conflict { * @param war the war * @return the boolean */ - public boolean equals(@NotNull War war) { + public boolean equals(War war) { return this.uuid.equals(war.getUUID()); } @@ -817,9 +821,9 @@ public class War extends Conflict { * * @param loserSide the loser side */ - public void defeat(@NotNull Side loserSide) { - @NotNull Side loser = loserSide.equals(getSide1()) ? getSide1() : getSide2(); - @NotNull Side winner = loserSide.equals(getSide1()) ? getSide2() : getSide1(); + public void defeat(Side loserSide) { + Side loser = loserSide.equals(getSide1()) ? getSide1() : getSide2(); + Side winner = loserSide.equals(getSide1()) ? getSide2() : getSide1(); Bukkit.broadcast(ColorParser.of(UtilsChat.getPrefix() + "The war of has ended. has triumphed against .") .parseMinimessagePlaceholder("war", getLabel()) diff --git a/src/main/java/com/github/alathra/AlathranWars/conflict/WarBuilder.java b/src/main/java/com/github/alathra/AlathranWars/conflict/war/WarBuilder.java similarity index 74% rename from src/main/java/com/github/alathra/AlathranWars/conflict/WarBuilder.java rename to src/main/java/com/github/alathra/AlathranWars/conflict/war/WarBuilder.java index 54e5488..817f8ff 100644 --- a/src/main/java/com/github/alathra/AlathranWars/conflict/WarBuilder.java +++ b/src/main/java/com/github/alathra/AlathranWars/conflict/war/WarBuilder.java @@ -1,5 +1,7 @@ -package com.github.alathra.AlathranWars.conflict; +package com.github.alathra.AlathranWars.conflict.war; +import com.github.alathra.AlathranWars.conflict.war.side.Side; +import com.github.alathra.AlathranWars.conflict.war.side.SideCreationException; import com.github.alathra.AlathranWars.conflict.battle.raid.Raid; import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; import com.github.alathra.AlathranWars.enums.ConflictType; @@ -7,10 +9,8 @@ import com.palmergames.bukkit.towny.object.Government; import com.palmergames.bukkit.towny.object.Nation; import com.palmergames.bukkit.towny.object.Town; import dev.jorel.commandapi.exceptions.WrapperCommandSyntaxException; -import org.jetbrains.annotations.NotNull; import java.util.HashSet; -import java.util.Optional; import java.util.Set; import java.util.UUID; @@ -25,11 +25,6 @@ public class WarBuilder { private Set sieges = new HashSet<>(); private Set raids = new HashSet<>(); - private Town aggressorTown; - private Optional aggressorNation = Optional.empty(); - private Town victimTown; - private Optional victimNation = Optional.empty(); - private Government aggressor; private Government victim; @@ -60,27 +55,6 @@ public class WarBuilder { ); } - /*public War create() throws WrapperCommandSyntaxException { - this.setUuid(UUID.randomUUID()); - - if (aggressorNation.isEmpty() && aggressorTown != null) { - // TODO Throw - } - if (victimNation.isEmpty() && victimTown != null) { - // TODO Throw - } - - return new War( - uuid, - label, - aggressorTown, - victimTown, - aggressorNation.isPresent(), - victimNation.isPresent(), - event - ); - }*/ - public War create() throws WrapperCommandSyntaxException, SideCreationException { this.setUuid(UUID.randomUUID()); @@ -139,24 +113,18 @@ public class WarBuilder { } public WarBuilder setAggressorTown(Town target) { - this.aggressorTown = target; return this; } public WarBuilder setAggressorNation(Nation target) { - this.aggressorTown = target.getCapital(); - this.aggressorNation = Optional.of(target); return this; } public WarBuilder setVictimTown(Town target) { - this.victimTown = target; return this; } public WarBuilder setVictimNation(Nation target) { - this.victimTown = target.getCapital(); - this.victimNation = Optional.of(target); return this; } diff --git a/src/main/java/com/github/alathra/AlathranWars/conflict/WarController.java b/src/main/java/com/github/alathra/AlathranWars/conflict/war/WarController.java similarity index 52% rename from src/main/java/com/github/alathra/AlathranWars/conflict/WarController.java rename to src/main/java/com/github/alathra/AlathranWars/conflict/war/WarController.java index 3712766..107191e 100644 --- a/src/main/java/com/github/alathra/AlathranWars/conflict/WarController.java +++ b/src/main/java/com/github/alathra/AlathranWars/conflict/war/WarController.java @@ -1,5 +1,6 @@ -package com.github.alathra.AlathranWars.conflict; +package com.github.alathra.AlathranWars.conflict.war; +import com.github.alathra.AlathranWars.conflict.war.side.Side; import com.github.alathra.AlathranWars.conflict.battle.raid.Raid; import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; import com.github.alathra.AlathranWars.db.DatabaseQueries; @@ -7,6 +8,7 @@ import com.palmergames.bukkit.towny.object.Nation; import com.palmergames.bukkit.towny.object.Town; import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -17,6 +19,9 @@ import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; +/** + * The singleton War controller. + */ @Singleton public class WarController { private static WarController instance; @@ -27,6 +32,11 @@ public class WarController { Bukkit.getServer().getLogger().warning("Tried to re-initialize singleton"); } + /** + * Gets or creates an instance of the war controller. + * + * @return the instance + */ @NotNull public static WarController getInstance() { if (instance == null) @@ -35,128 +45,264 @@ public class WarController { return instance; } + /** + * Load all wars into memory from database. + */ + @ApiStatus.Internal public void loadAll() { wars = DatabaseQueries.loadAll(); } + /** + * Gets all wars. + * + * @return the wars + */ @NotNull public Set getWars() { return wars; } + /** + * Gets war by its name or returns null. + * + * @param warName the war name + * @return the war + */ @Nullable public War getWar(String warName) { - for (@NotNull War war : getWars()) - if (war.equals(warName)) return war; - - return null; + return getWars().stream() + .filter(war -> war.equals(warName)) + .findAny() + .orElse(null); } + /** + * Gets war by its UUID or returns null. + * + * @param uuid the uuid + * @return the war + */ @Nullable public War getWar(UUID uuid) { - for (@NotNull War war : getWars()) - if (war.equals(uuid)) return war; - - return null; + return getWars().stream() + .filter(war -> war.equals(uuid)) + .findAny() + .orElse(null); } + /** + * Gets side by the side UUID. + * + * @param uuid the uuid + * @return the side + */ @Nullable public Side getSide(UUID uuid) { - for (@NotNull War war : getWars()) - if (war.getSide(uuid) != null) return war.getSide(uuid); - - return null; + return getWars().stream() + .filter(war -> war.getSide(uuid) != null) + .map(war -> war.getSide(uuid)) + .findAny() + .orElse(null); } + /** + * Gets siege by the siege UUID. + * + * @param uuid the uuid + * @return the siege + */ @Nullable public Siege getSiege(UUID uuid) { - for (@NotNull War war : getWars()) - if (war.getSiege(uuid) != null) return war.getSiege(uuid); - - return null; + return getWars().stream() + .filter(war -> war.getSiege(uuid) != null) + .map(war -> war.getSiege(uuid)) + .findAny() + .orElse(null); } + /** + * Add a war to the war controller. + * + * @param war the war + */ + @ApiStatus.Internal public void addWar(War war) { getWars().add(war); } + /** + * Remove a war from the war controller. + * + * @param war the war + */ + @ApiStatus.Internal public void removeWar(War war) { getWars().remove(war); } + /** + * Is player in any wars. Includes if surrendered. + * + * @param uuid the uuid + * @return the boolean + */ public boolean isPlayerInAnyWars(UUID uuid) { return getWars().stream() .anyMatch(war -> war.isPlayerInWar(uuid)); } - public boolean isPlayerInAnyWars(@NotNull Player p) { + /** + * Is player in any wars. Includes if surrendered. + * + * @param p the p + * @return the boolean + */ + public boolean isPlayerInAnyWars(Player p) { return isPlayerInAnyWars(p.getUniqueId()); } - public @NotNull Set getPlayerWars(@NotNull Player p) { + /** + * Gets list of player wars. Includes if surrendered. + * + * @param p the p + * @return the player wars + */ + public @NotNull Set getPlayerWars(Player p) { return getPlayerWars(p.getUniqueId()); } + /** + * Gets list of player wars. Includes if surrendered. + * + * @param uuid the uuid + * @return the player wars + */ public @NotNull Set getPlayerWars(UUID uuid) { return getWars().stream() .filter(war -> war.isPlayerInWar(uuid)) .collect(Collectors.toSet()); } + /** + * Is town in any wars. Includes surrendered towns. + * + * @param town the town + * @return the boolean + */ public boolean isTownInAnyWars(Town town) { return getWars().stream() .anyMatch(war -> war.isTownInWar(town)); } + /** + * Is town in any sieges. Includes surrendered towns. + * + * @param town the town + * @return the boolean + */ public boolean isTownInAnySieges(Town town) { return getWars().stream() .anyMatch(war -> war.isTownInWar(town) && war.isTownUnderSiege(town)); } + /** + * Is town in any raids. Includes surrendered towns. + * + * @param town the town + * @return the boolean + */ public boolean isTownInAnyRaids(Town town) { return getWars().stream() .anyMatch(war -> war.isTownInWar(town) && war.isTownUnderRaid(town)); } + /** + * Is nation in any sieges. Includes surrendered nations. + * + * @param nation the nation + * @return the boolean + */ public boolean isNationInAnySieges(Nation nation) { return nation.getTowns().stream() .anyMatch(this::isTownInAnySieges); } + /** + * Is nation in any raids. Includes surrendered nations. + * + * @param nation the nation + * @return the boolean + */ public boolean isNationInAnyRaids(Nation nation) { return nation.getTowns().stream() .anyMatch(this::isTownInAnyRaids); } + /** + * Gets town sieges. Includes surrendered towns. + * + * @param town the town + * @return the town sieges + */ public @NotNull Set getTownSieges(Town town) { return getSieges().stream() .filter(siege -> siege.getAttackerSide().isTownOnSide(town) || siege.getDefenderSide().isTownOnSide(town)) .collect(Collectors.toSet()); } + /** + * Gets town raids. Includes surrendered towns. + * + * @param town the town + * @return the town raids + */ public @NotNull Set getTownRaids(Town town) { return getRaids().stream() .filter(raid -> raid.getAttackerSide().isTownOnSide(town) || raid.getDefenderSide().isTownOnSide(town)) .collect(Collectors.toSet()); } + /** + * Gets town wars. Includes surrendered towns. + * + * @param town the town + * @return the town wars + */ public @NotNull Set getTownWars(Town town) { return getWars().stream() .filter(war -> war.isTownInWar(town)) .collect(Collectors.toSet()); } + /** + * Is nation in any wars. Includes surrendered nations. + * + * @param nation the nation + * @return the boolean + */ public boolean isNationInAnyWars(Nation nation) { return getWars().stream() .anyMatch(war -> war.isNationInWar(nation)); } + /** + * Gets nation wars. Includes surrendered nations. + * + * @param nation the nation + * @return the nation wars + */ public @NotNull Set getNationWars(Nation nation) { return getWars().stream() .filter(war -> war.isNationInWar(nation)) .collect(Collectors.toSet()); } + /** + * Gets a list of war names. + * + * @return the war names + */ @NotNull public List getWarNames() { return getWars().stream() @@ -165,6 +311,11 @@ public class WarController { .collect(Collectors.toList()); } + /** + * Gets a list of war labels. + * + * @return the war labels + */ @NotNull public List getWarLabels() { return getWars().stream() @@ -173,6 +324,11 @@ public class WarController { .collect(Collectors.toList()); } + /** + * Gets a list of all active sieges. + * + * @return the sieges + */ @NotNull public Set getSieges() { return getWars().stream() @@ -181,6 +337,11 @@ public class WarController { .collect(Collectors.toSet()); } + /** + * Gets a list of all active raids. + * + * @return the raids + */ @NotNull public Set getRaids() { return getWars().stream() @@ -189,25 +350,54 @@ public class WarController { .collect(Collectors.toSet()); } - public boolean isPlayerInAnySiege(@NotNull Player p) { + /** + * Is player in any siege. + * + * @param p the p + * @return the boolean + */ + public boolean isPlayerInAnySiege(Player p) { return isPlayerInAnySiege(p.getUniqueId()); } + /** + * Is player in any siege. Returns true for offline players. + * + * @param uuid the uuid + * @return the boolean + */ public boolean isPlayerInAnySiege(UUID uuid) { return getSieges().stream() .anyMatch(siege -> siege.isPlayerInSiege(uuid)); } - public @NotNull Set getPlayerSieges(@NotNull Player p) { + /** + * Gets player sieges. + * + * @param p the p + * @return the player sieges + */ + public @NotNull Set getPlayerSieges(Player p) { return getPlayerSieges(p.getUniqueId()); } + /** + * Gets player sieges. Returns true for offline players. + * + * @param uuid the uuid + * @return the player sieges + */ public @NotNull Set getPlayerSieges(UUID uuid) { return getSieges().stream() .filter(siege -> siege.isPlayerInSiege(uuid)) .collect(Collectors.toSet()); } + /** + * Gets nations at war. Does not include surrendered nations. + * + * @return the nations at war + */ public @NotNull Set getNationsAtWar() { return getWars().stream() .map(War::getNations) @@ -215,6 +405,11 @@ public class WarController { .collect(Collectors.toSet()); } + /** + * Gets towns at war. Does not include surrendered towns. + * + * @return the towns at war + */ public @NotNull Set getTownsAtWar() { return getWars().stream() .map(War::getTowns) diff --git a/src/main/java/com/github/alathra/AlathranWars/conflict/WarCreationException.java b/src/main/java/com/github/alathra/AlathranWars/conflict/war/WarCreationException.java similarity index 54% rename from src/main/java/com/github/alathra/AlathranWars/conflict/WarCreationException.java rename to src/main/java/com/github/alathra/AlathranWars/conflict/war/WarCreationException.java index fec1cbb..20bab7c 100644 --- a/src/main/java/com/github/alathra/AlathranWars/conflict/WarCreationException.java +++ b/src/main/java/com/github/alathra/AlathranWars/conflict/war/WarCreationException.java @@ -1,4 +1,6 @@ -package com.github.alathra.AlathranWars.conflict; +package com.github.alathra.AlathranWars.conflict.war; + +import com.github.alathra.AlathranWars.conflict.war.side.SideCreationException; public class WarCreationException extends SideCreationException { public WarCreationException(String errorMessage) { diff --git a/src/main/java/com/github/alathra/AlathranWars/conflict/Side.java b/src/main/java/com/github/alathra/AlathranWars/conflict/war/side/Side.java similarity index 77% rename from src/main/java/com/github/alathra/AlathranWars/conflict/Side.java rename to src/main/java/com/github/alathra/AlathranWars/conflict/war/side/Side.java index a4fca04..4b8b511 100644 --- a/src/main/java/com/github/alathra/AlathranWars/conflict/Side.java +++ b/src/main/java/com/github/alathra/AlathranWars/conflict/war/side/Side.java @@ -1,6 +1,8 @@ -package com.github.alathra.AlathranWars.conflict; +package com.github.alathra.AlathranWars.conflict.war.side; import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; +import com.github.alathra.AlathranWars.conflict.war.War; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.enums.battle.BattleSide; import com.github.alathra.AlathranWars.enums.battle.BattleTeam; import com.github.alathra.AlathranWars.hooks.NameColorHandler; @@ -89,31 +91,6 @@ public class Side { calculateOnlinePlayers(); } - /*public Side(UUID warUUID, UUID uuid, Town town, boolean isNation, BattleSide side, BattleTeam team) { - this.warUUID = warUUID; - this.uuid = uuid; - this.side = side; - this.team = team; - this.town = town; - this.name = this.town.getName(); - - this.towns = new HashSet<>(); - this.nations = new HashSet<>(); - this.playersIncludingOffline = new HashSet<>(); - this.players = new HashSet<>(); - - this.surrenderedTowns = new HashSet<>(); - this.surrenderedNations = new HashSet<>(); - this.surrenderedPlayersIncludingOffline = new HashSet<>(); - - if (isNation) - addNation(Objects.requireNonNull(this.town.getNationOrNull())); - else - addTown(this.town); - - calculateOnlinePlayers(); - }*/ - public Side(UUID warUUID, UUID uuid, Government government, BattleSide side, BattleTeam team) throws SideCreationException { this.warUUID = warUUID; this.uuid = uuid; @@ -144,50 +121,6 @@ public class Side { calculateOnlinePlayers(); } - /*public Side(UUID warUUID, UUID uuid, Town town, BattleSide side, BattleTeam team) { - this.warUUID = warUUID; - this.uuid = uuid; - this.side = side; - this.team = team; - this.town = town; - this.name = this.town.getName(); - - this.towns = new HashSet<>(); - this.nations = new HashSet<>(); - this.playersIncludingOffline = new HashSet<>(); - this.players = new HashSet<>(); - - this.surrenderedTowns = new HashSet<>(); - this.surrenderedNations = new HashSet<>(); - this.surrenderedPlayersIncludingOffline = new HashSet<>(); - - addTown(this.town); - - calculateOnlinePlayers(); - } - - public Side(UUID warUUID, UUID uuid, @NotNull Nation nation, BattleSide side, BattleTeam team) { - this.warUUID = warUUID; - this.uuid = uuid; - this.side = side; - this.team = team; - this.town = nation.getCapital(); - this.name = this.town.getName(); - - this.towns = new HashSet<>(); - this.nations = new HashSet<>(); - this.playersIncludingOffline = new HashSet<>(); - this.players = new HashSet<>(); - - this.surrenderedTowns = new HashSet<>(); - this.surrenderedNations = new HashSet<>(); - this.surrenderedPlayersIncludingOffline = new HashSet<>(); - - addNation(nation); - - calculateOnlinePlayers(); - }*/ - public BattleSide getSide() { return side; } @@ -246,7 +179,7 @@ public class Side { return surrenderedNations.contains(nation); } - public void addTown(@NotNull Town town) { + public void addTown(Town town) { if (isTownOnSide(town)) return; towns.add(town); @@ -254,7 +187,7 @@ public class Side { town.getResidents().forEach((Resident resident) -> addPlayer(resident.getUUID())); } - public void addNation(@NotNull Nation nation) { + public void addNation(Nation nation) { if (isNationOnSide(nation)) return; nations.add(nation); @@ -262,7 +195,7 @@ public class Side { nation.getTowns().forEach(this::addTown); } - public void removeTown(@NotNull Town town) { + public void removeTown(Town town) { if (!isTownOnSide(town)) return; towns.remove(town); @@ -270,7 +203,7 @@ public class Side { town.getResidents().forEach((Resident resident) -> removePlayer(resident.getUUID())); } - public void removeNation(@NotNull Nation nation) { + public void removeNation(Nation nation) { if (!isNationOnSide(nation)) return; nations.remove(nation); @@ -278,7 +211,7 @@ public class Side { nation.getTowns().forEach(this::removeTown); } - public void surrenderTown(@NotNull Town town) { + public void surrenderTown(Town town) { if (isTownSurrendered(town)) return; removeTown(town); @@ -288,7 +221,7 @@ public class Side { town.getResidents().forEach((Resident resident) -> surrenderPlayer(resident.getUUID())); } - public void surrenderNation(@NotNull Nation nation) { + public void surrenderNation(Nation nation) { if (isNationSurrendered(nation)) return; removeNation(nation); @@ -298,7 +231,7 @@ public class Side { nation.getTowns().forEach(this::surrenderTown); } - public void unsurrenderTown(@NotNull Town town) { + public void unsurrenderTown(Town town) { if (!isTownSurrendered(town)) return; addTown(town); @@ -308,7 +241,7 @@ public class Side { town.getResidents().forEach((Resident resident) -> unsurrenderPlayer(resident.getUUID())); } - public void unsurrenderNation(@NotNull Nation nation) { + public void unsurrenderNation(Nation nation) { if (!isNationSurrendered(nation)) return; addNation(nation); @@ -318,7 +251,7 @@ public class Side { nation.getTowns().forEach(this::unsurrenderTown); } - public boolean isPlayerOnSide(@NotNull Player p) { + public boolean isPlayerOnSide(Player p) { return isPlayerOnSide(p.getUniqueId()); } @@ -326,7 +259,7 @@ public class Side { return playersIncludingOffline.contains(uuid) || surrenderedPlayersIncludingOffline.contains(uuid); } - public boolean isPlayerSurrendered(@NotNull Player p) { + public boolean isPlayerSurrendered(Player p) { return isPlayerSurrendered(p.getUniqueId()); } @@ -334,21 +267,21 @@ public class Side { return surrenderedPlayersIncludingOffline.contains(uuid); } - public void addPlayer(@NotNull Player p) { + public void addPlayer(Player p) { addPlayer(p.getUniqueId()); } - public void addPlayer(@NotNull OfflinePlayer offlinePlayer) { + public void addPlayer(OfflinePlayer offlinePlayer) { if (offlinePlayer.hasPlayedBefore()) addPlayer(offlinePlayer.getUniqueId()); } - public void addPlayer(@NotNull UUID uuid) { + public void addPlayer(UUID uuid) { if (isPlayerOnSide(uuid)) return; playersIncludingOffline.add(uuid); if (getWar() != null) { // We need to check this as on side creation War doesn't exist - for (@NotNull Siege siege : getWar().getSieges()) { + for (Siege siege : getWar().getSieges()) { if (siege.getAttackerSide().equals(this)) { siege.addPlayer(uuid, BattleSide.ATTACKER); } else { @@ -367,21 +300,21 @@ public class Side { players.add(p); } - public void removePlayer(@NotNull Player p) { + public void removePlayer(Player p) { removePlayer(p.getUniqueId()); } - public void removePlayer(@NotNull OfflinePlayer offlinePlayer) { + public void removePlayer(OfflinePlayer offlinePlayer) { if (offlinePlayer.hasPlayedBefore()) removePlayer(offlinePlayer.getUniqueId()); } - public void removePlayer(@NotNull UUID uuid) { + public void removePlayer(UUID uuid) { if (!isPlayerOnSide(uuid)) return; playersIncludingOffline.remove(uuid); if (getWar() != null) { // We need to check this as on side creation War doesn't exist - for (@NotNull Siege siege : getWar().getSieges()) { + for (Siege siege : getWar().getSieges()) { if (siege.getAttackerSide().equals(this)) { siege.removePlayer(uuid); } else { @@ -400,11 +333,11 @@ public class Side { players.remove(p); } - public void surrenderPlayer(@NotNull Player p) { + public void surrenderPlayer(Player p) { surrenderPlayer(p.getUniqueId()); } - public void surrenderPlayer(@NotNull UUID uuid) { + public void surrenderPlayer(UUID uuid) { if (isPlayerSurrendered(uuid)) return; removePlayer(uuid); @@ -412,11 +345,11 @@ public class Side { applyNameTags(); } - public void unsurrenderPlayer(@NotNull Player p) { + public void unsurrenderPlayer(Player p) { unsurrenderPlayer(p.getUniqueId()); } - public void unsurrenderPlayer(@NotNull UUID uuid) { + public void unsurrenderPlayer(UUID uuid) { if (!isPlayerSurrendered(uuid)) return; addPlayer(uuid); @@ -425,7 +358,7 @@ public class Side { } public void calculateOnlinePlayers() { - final @NotNull Set onlinePlayers = getPlayersIncludingOffline().stream() + final Set onlinePlayers = getPlayersIncludingOffline().stream() .filter(uuid -> Bukkit.getOfflinePlayer(uuid).isOnline()) .map(Bukkit::getPlayer) .collect(Collectors.toSet()); @@ -499,11 +432,11 @@ public class Side { return this.uuid.equals(uuid); } - public boolean equals(@NotNull War war) { + public boolean equals(War war) { return this.warUUID.equals(war.getUUID()); } - public boolean equals(@NotNull Side side) { + public boolean equals(Side side) { return getUUID().equals(side.getUUID()); } diff --git a/src/main/java/com/github/alathra/AlathranWars/conflict/SideBuilder.java b/src/main/java/com/github/alathra/AlathranWars/conflict/war/side/SideBuilder.java similarity index 95% rename from src/main/java/com/github/alathra/AlathranWars/conflict/SideBuilder.java rename to src/main/java/com/github/alathra/AlathranWars/conflict/war/side/SideBuilder.java index 9ab1fde..9d28dd6 100644 --- a/src/main/java/com/github/alathra/AlathranWars/conflict/SideBuilder.java +++ b/src/main/java/com/github/alathra/AlathranWars/conflict/war/side/SideBuilder.java @@ -1,26 +1,42 @@ -package com.github.alathra.AlathranWars.conflict; +package com.github.alathra.AlathranWars.conflict.war.side; import com.github.alathra.AlathranWars.enums.battle.BattleSide; import com.github.alathra.AlathranWars.enums.battle.BattleTeam; import com.palmergames.bukkit.towny.object.Government; import com.palmergames.bukkit.towny.object.Nation; import com.palmergames.bukkit.towny.object.Town; -import org.bukkit.entity.Player; import java.time.Instant; import java.util.Set; import java.util.UUID; public class SideBuilder { + private UUID warUUID; + private UUID uuid; + private BattleSide side; + private BattleTeam team; + private String name; + + private Government government; + + private Set towns; + private Set nations; + private Set playersIncludingOffline; + private Set surrenderedTowns; + private Set surrenderedNations; + private Set surrenderedPlayersIncludingOffline; + private Instant siegeGrace; + private Instant raidGrace; + public SideBuilder() {} - public Side buildOld() throws SideCreationException { + public Side rebuild() throws SideCreationException { // if (warUUID == null || uuid == null || town == null || side == null || team == null || name == null || // towns == null || nations == null || playersIncludingOffline == null || // surrenderedTowns == null || surrenderedNations == null || surrenderedPlayersIncludingOffline == null || // siegeGrace == null || raidGrace == null // ) throw new IllegalStateException("Missing state to create Side 1"); - + // TODO Cleanup this shit if (warUUID == null || uuid == null ) throw new IllegalStateException("Missing state to create Side 1.2"); @@ -56,7 +72,7 @@ public class SideBuilder { ); } - public Side buildNew() throws SideCreationException { + public Side build() throws SideCreationException { if (warUUID == null || uuid == null || government == null || side == null || team == null) throw new IllegalStateException("Missing state to create new Side"); @@ -138,25 +154,4 @@ public class SideBuilder { this.raidGrace = raidGrace; return this; } - - private UUID warUUID; - private UUID uuid; - private BattleSide side; - private BattleTeam team; - private String name; - - private Government government; - private Town town; - - private Set towns; - private Set nations; - private Set playersIncludingOffline; - private Set surrenderedTowns; - private Set surrenderedNations; - private Set surrenderedPlayersIncludingOffline; - private Instant siegeGrace; - private Instant raidGrace; - - - } diff --git a/src/main/java/com/github/alathra/AlathranWars/conflict/SideCreationException.java b/src/main/java/com/github/alathra/AlathranWars/conflict/war/side/SideCreationException.java similarity index 71% rename from src/main/java/com/github/alathra/AlathranWars/conflict/SideCreationException.java rename to src/main/java/com/github/alathra/AlathranWars/conflict/war/side/SideCreationException.java index 999b053..a9a1ca8 100644 --- a/src/main/java/com/github/alathra/AlathranWars/conflict/SideCreationException.java +++ b/src/main/java/com/github/alathra/AlathranWars/conflict/war/side/SideCreationException.java @@ -1,4 +1,4 @@ -package com.github.alathra.AlathranWars.conflict; +package com.github.alathra.AlathranWars.conflict.war.side; public class SideCreationException extends Exception { public SideCreationException(String errorMessage) { diff --git a/src/main/java/com/github/alathra/AlathranWars/db/DatabaseQueries.java b/src/main/java/com/github/alathra/AlathranWars/db/DatabaseQueries.java index 9a5b59c..2f6fd18 100644 --- a/src/main/java/com/github/alathra/AlathranWars/db/DatabaseQueries.java +++ b/src/main/java/com/github/alathra/AlathranWars/db/DatabaseQueries.java @@ -1,7 +1,12 @@ package com.github.alathra.AlathranWars.db; -import com.github.alathra.AlathranWars.conflict.*; import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; +import com.github.alathra.AlathranWars.conflict.war.War; +import com.github.alathra.AlathranWars.conflict.war.WarBuilder; +import com.github.alathra.AlathranWars.conflict.war.WarController; +import com.github.alathra.AlathranWars.conflict.war.side.Side; +import com.github.alathra.AlathranWars.conflict.war.side.SideBuilder; +import com.github.alathra.AlathranWars.conflict.war.side.SideCreationException; import com.github.alathra.AlathranWars.enums.battle.BattleSide; import com.github.alathra.AlathranWars.enums.battle.BattleTeam; import com.github.alathra.AlathranWars.utility.DB; @@ -456,7 +461,7 @@ public abstract class DatabaseQueries { .setSurrenderedPlayersIncludingOffline(playersSurrendered) .setSiegeGrace(siegeGrace) .setRaidGrace(raidGrace) - .buildOld(); + .rebuild(); } catch (SideCreationException e) { Logger.get().error("SQL Query threw an error!", e); } diff --git a/src/main/java/com/github/alathra/AlathranWars/events/PreWarCreateEvent.java b/src/main/java/com/github/alathra/AlathranWars/events/PreWarCreateEvent.java index ba54cdf..ecb0d25 100644 --- a/src/main/java/com/github/alathra/AlathranWars/events/PreWarCreateEvent.java +++ b/src/main/java/com/github/alathra/AlathranWars/events/PreWarCreateEvent.java @@ -1,6 +1,6 @@ package com.github.alathra.AlathranWars.events; -import com.github.alathra.AlathranWars.conflict.War; +import com.github.alathra.AlathranWars.conflict.war.War; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; diff --git a/src/main/java/com/github/alathra/AlathranWars/events/PreWarDeleteEvent.java b/src/main/java/com/github/alathra/AlathranWars/events/PreWarDeleteEvent.java index 143df21..304a0e1 100644 --- a/src/main/java/com/github/alathra/AlathranWars/events/PreWarDeleteEvent.java +++ b/src/main/java/com/github/alathra/AlathranWars/events/PreWarDeleteEvent.java @@ -1,6 +1,6 @@ package com.github.alathra.AlathranWars.events; -import com.github.alathra.AlathranWars.conflict.War; +import com.github.alathra.AlathranWars.conflict.war.War; import com.github.alathra.AlathranWars.enums.WarDeleteReason; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; diff --git a/src/main/java/com/github/alathra/AlathranWars/events/WarCreateEvent.java b/src/main/java/com/github/alathra/AlathranWars/events/WarCreateEvent.java index 667367d..7f1c98e 100644 --- a/src/main/java/com/github/alathra/AlathranWars/events/WarCreateEvent.java +++ b/src/main/java/com/github/alathra/AlathranWars/events/WarCreateEvent.java @@ -1,6 +1,6 @@ package com.github.alathra.AlathranWars.events; -import com.github.alathra.AlathranWars.conflict.War; +import com.github.alathra.AlathranWars.conflict.war.War; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/com/github/alathra/AlathranWars/events/WarDeleteEvent.java b/src/main/java/com/github/alathra/AlathranWars/events/WarDeleteEvent.java index 31f8098..4ec74fc 100644 --- a/src/main/java/com/github/alathra/AlathranWars/events/WarDeleteEvent.java +++ b/src/main/java/com/github/alathra/AlathranWars/events/WarDeleteEvent.java @@ -1,6 +1,6 @@ package com.github.alathra.AlathranWars.events; -import com.github.alathra.AlathranWars.conflict.War; +import com.github.alathra.AlathranWars.conflict.war.War; import com.github.alathra.AlathranWars.enums.WarDeleteReason; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; diff --git a/src/main/java/com/github/alathra/AlathranWars/events/battle/BattleResultEvent.java b/src/main/java/com/github/alathra/AlathranWars/events/battle/BattleResultEvent.java index d2b12b6..37e23fc 100644 --- a/src/main/java/com/github/alathra/AlathranWars/events/battle/BattleResultEvent.java +++ b/src/main/java/com/github/alathra/AlathranWars/events/battle/BattleResultEvent.java @@ -1,6 +1,6 @@ package com.github.alathra.AlathranWars.events.battle; -import com.github.alathra.AlathranWars.conflict.War; +import com.github.alathra.AlathranWars.conflict.war.War; import com.github.alathra.AlathranWars.conflict.battle.Battle; import com.github.alathra.AlathranWars.enums.battle.BattleVictor; import com.github.alathra.AlathranWars.enums.battle.BattleVictoryReason; diff --git a/src/main/java/com/github/alathra/AlathranWars/events/battle/BattleStartEvent.java b/src/main/java/com/github/alathra/AlathranWars/events/battle/BattleStartEvent.java index a977369..ac7794b 100644 --- a/src/main/java/com/github/alathra/AlathranWars/events/battle/BattleStartEvent.java +++ b/src/main/java/com/github/alathra/AlathranWars/events/battle/BattleStartEvent.java @@ -1,6 +1,6 @@ package com.github.alathra.AlathranWars.events.battle; -import com.github.alathra.AlathranWars.conflict.War; +import com.github.alathra.AlathranWars.conflict.war.War; import com.github.alathra.AlathranWars.conflict.battle.Battle; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; diff --git a/src/main/java/com/github/alathra/AlathranWars/events/battle/PreBattleResultEvent.java b/src/main/java/com/github/alathra/AlathranWars/events/battle/PreBattleResultEvent.java index 2cf76b2..b0997d5 100644 --- a/src/main/java/com/github/alathra/AlathranWars/events/battle/PreBattleResultEvent.java +++ b/src/main/java/com/github/alathra/AlathranWars/events/battle/PreBattleResultEvent.java @@ -1,6 +1,6 @@ package com.github.alathra.AlathranWars.events.battle; -import com.github.alathra.AlathranWars.conflict.War; +import com.github.alathra.AlathranWars.conflict.war.War; import com.github.alathra.AlathranWars.conflict.battle.Battle; import com.github.alathra.AlathranWars.enums.battle.BattleType; import com.github.alathra.AlathranWars.enums.battle.BattleVictor; diff --git a/src/main/java/com/github/alathra/AlathranWars/events/battle/PreBattleStartEvent.java b/src/main/java/com/github/alathra/AlathranWars/events/battle/PreBattleStartEvent.java index 43d3218..8c74159 100644 --- a/src/main/java/com/github/alathra/AlathranWars/events/battle/PreBattleStartEvent.java +++ b/src/main/java/com/github/alathra/AlathranWars/events/battle/PreBattleStartEvent.java @@ -1,6 +1,6 @@ package com.github.alathra.AlathranWars.events.battle; -import com.github.alathra.AlathranWars.conflict.War; +import com.github.alathra.AlathranWars.conflict.war.War; import com.github.alathra.AlathranWars.conflict.battle.Battle; import com.github.alathra.AlathranWars.enums.battle.BattleType; import org.bukkit.event.Cancellable; diff --git a/src/main/java/com/github/alathra/AlathranWars/hooks/NameColorHandler.java b/src/main/java/com/github/alathra/AlathranWars/hooks/NameColorHandler.java index f8d4fd6..7f7ab85 100644 --- a/src/main/java/com/github/alathra/AlathranWars/hooks/NameColorHandler.java +++ b/src/main/java/com/github/alathra/AlathranWars/hooks/NameColorHandler.java @@ -1,7 +1,7 @@ package com.github.alathra.AlathranWars.hooks; -import com.github.alathra.AlathranWars.conflict.War; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.War; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.utility.Logger; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/com/github/alathra/AlathranWars/listeners/CommandsListener.java b/src/main/java/com/github/alathra/AlathranWars/listeners/CommandsListener.java index 41e1e0b..821b08e 100644 --- a/src/main/java/com/github/alathra/AlathranWars/listeners/CommandsListener.java +++ b/src/main/java/com/github/alathra/AlathranWars/listeners/CommandsListener.java @@ -1,6 +1,6 @@ package com.github.alathra.AlathranWars.listeners; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; import com.github.alathra.AlathranWars.utility.Utils; import com.github.alathra.AlathranWars.utility.UtilsChat; diff --git a/src/main/java/com/github/alathra/AlathranWars/listeners/items/PlayerInteractListener.java b/src/main/java/com/github/alathra/AlathranWars/listeners/items/PlayerInteractListener.java index d882eea..4b52ebb 100644 --- a/src/main/java/com/github/alathra/AlathranWars/listeners/items/PlayerInteractListener.java +++ b/src/main/java/com/github/alathra/AlathranWars/listeners/items/PlayerInteractListener.java @@ -1,7 +1,7 @@ package com.github.alathra.AlathranWars.listeners.items; import com.github.alathra.AlathranWars.AlathranWars; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; import com.github.alathra.AlathranWars.items.WarItemRegistry; import com.github.alathra.AlathranWars.utility.UtilsChat; diff --git a/src/main/java/com/github/alathra/AlathranWars/listeners/siege/PlayerJoinListener.java b/src/main/java/com/github/alathra/AlathranWars/listeners/siege/PlayerJoinListener.java index e5294fa..ed2f7a7 100644 --- a/src/main/java/com/github/alathra/AlathranWars/listeners/siege/PlayerJoinListener.java +++ b/src/main/java/com/github/alathra/AlathranWars/listeners/siege/PlayerJoinListener.java @@ -1,6 +1,6 @@ package com.github.alathra.AlathranWars.listeners.siege; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; import com.github.alathra.AlathranWars.enums.battle.BattleSide; import org.bukkit.entity.Player; diff --git a/src/main/java/com/github/alathra/AlathranWars/listeners/siege/PlayerQuitListener.java b/src/main/java/com/github/alathra/AlathranWars/listeners/siege/PlayerQuitListener.java index 2cf1201..2ebf891 100644 --- a/src/main/java/com/github/alathra/AlathranWars/listeners/siege/PlayerQuitListener.java +++ b/src/main/java/com/github/alathra/AlathranWars/listeners/siege/PlayerQuitListener.java @@ -1,6 +1,6 @@ package com.github.alathra.AlathranWars.listeners.siege; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; import com.github.alathra.AlathranWars.enums.battle.BattleSide; import org.bukkit.entity.Player; diff --git a/src/main/java/com/github/alathra/AlathranWars/listeners/siege/SiegeListener.java b/src/main/java/com/github/alathra/AlathranWars/listeners/siege/SiegeListener.java index c5cf414..94cafb3 100644 --- a/src/main/java/com/github/alathra/AlathranWars/listeners/siege/SiegeListener.java +++ b/src/main/java/com/github/alathra/AlathranWars/listeners/siege/SiegeListener.java @@ -1,7 +1,7 @@ package com.github.alathra.AlathranWars.listeners.siege; -import com.github.alathra.AlathranWars.conflict.Side; -import com.github.alathra.AlathranWars.conflict.War; +import com.github.alathra.AlathranWars.conflict.war.side.Side; +import com.github.alathra.AlathranWars.conflict.war.War; import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; import com.github.alathra.AlathranWars.enums.battle.BattleType; import com.github.alathra.AlathranWars.enums.battle.BattleVictoryReason; diff --git a/src/main/java/com/github/alathra/AlathranWars/listeners/war/NationListener.java b/src/main/java/com/github/alathra/AlathranWars/listeners/war/NationListener.java index e9fc25a..a9c5092 100644 --- a/src/main/java/com/github/alathra/AlathranWars/listeners/war/NationListener.java +++ b/src/main/java/com/github/alathra/AlathranWars/listeners/war/NationListener.java @@ -1,8 +1,8 @@ package com.github.alathra.AlathranWars.listeners.war; -import com.github.alathra.AlathranWars.conflict.Side; -import com.github.alathra.AlathranWars.conflict.War; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.side.Side; +import com.github.alathra.AlathranWars.conflict.war.War; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.hooks.NameColorHandler; import com.palmergames.bukkit.towny.event.NationAddTownEvent; import com.palmergames.bukkit.towny.event.NationPreRenameEvent; diff --git a/src/main/java/com/github/alathra/AlathranWars/listeners/war/PlayerJoinListener.java b/src/main/java/com/github/alathra/AlathranWars/listeners/war/PlayerJoinListener.java index 51274cd..2e09a05 100644 --- a/src/main/java/com/github/alathra/AlathranWars/listeners/war/PlayerJoinListener.java +++ b/src/main/java/com/github/alathra/AlathranWars/listeners/war/PlayerJoinListener.java @@ -1,8 +1,8 @@ package com.github.alathra.AlathranWars.listeners.war; -import com.github.alathra.AlathranWars.conflict.Side; -import com.github.alathra.AlathranWars.conflict.War; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.side.Side; +import com.github.alathra.AlathranWars.conflict.war.War; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.hooks.NameColorHandler; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/com/github/alathra/AlathranWars/listeners/war/PlayerQuitListener.java b/src/main/java/com/github/alathra/AlathranWars/listeners/war/PlayerQuitListener.java index 8177853..d749950 100644 --- a/src/main/java/com/github/alathra/AlathranWars/listeners/war/PlayerQuitListener.java +++ b/src/main/java/com/github/alathra/AlathranWars/listeners/war/PlayerQuitListener.java @@ -1,8 +1,8 @@ package com.github.alathra.AlathranWars.listeners.war; -import com.github.alathra.AlathranWars.conflict.Side; -import com.github.alathra.AlathranWars.conflict.War; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.side.Side; +import com.github.alathra.AlathranWars.conflict.war.War; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.hooks.NameColorHandler; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/com/github/alathra/AlathranWars/listeners/war/TownListener.java b/src/main/java/com/github/alathra/AlathranWars/listeners/war/TownListener.java index 275a01f..3b04d41 100644 --- a/src/main/java/com/github/alathra/AlathranWars/listeners/war/TownListener.java +++ b/src/main/java/com/github/alathra/AlathranWars/listeners/war/TownListener.java @@ -1,8 +1,8 @@ package com.github.alathra.AlathranWars.listeners.war; -import com.github.alathra.AlathranWars.conflict.Side; -import com.github.alathra.AlathranWars.conflict.War; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.side.Side; +import com.github.alathra.AlathranWars.conflict.war.War; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.hooks.NameColorHandler; import com.github.milkdrinkers.colorparser.ColorParser; import com.palmergames.bukkit.towny.event.TownAddResidentEvent; diff --git a/src/main/java/com/github/alathra/AlathranWars/utility/UUIDUtil.java b/src/main/java/com/github/alathra/AlathranWars/utility/UUIDUtil.java index d0638bb..7b7f1ed 100644 --- a/src/main/java/com/github/alathra/AlathranWars/utility/UUIDUtil.java +++ b/src/main/java/com/github/alathra/AlathranWars/utility/UUIDUtil.java @@ -1,6 +1,6 @@ package com.github.alathra.AlathranWars.utility; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.WarController; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/com/github/alathra/AlathranWars/utility/Utils.java b/src/main/java/com/github/alathra/AlathranWars/utility/Utils.java index e555624..260ed2a 100644 --- a/src/main/java/com/github/alathra/AlathranWars/utility/Utils.java +++ b/src/main/java/com/github/alathra/AlathranWars/utility/Utils.java @@ -1,6 +1,6 @@ package com.github.alathra.AlathranWars.utility; -import com.github.alathra.AlathranWars.conflict.WarController; +import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; import com.palmergames.bukkit.towny.object.WorldCoord; import org.bukkit.Location;