mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-03 14:38:56 +00:00
refactor: cleanup and comment more
This commit is contained in:
34 files changed
+338
-232
No files matched your search
@@ -2,7 +2,7 @@ package com.github.alathra.AlathranWars;
|
|||||||
|
|
||||||
import com.github.alathra.AlathranWars.commands.CommandManager;
|
import com.github.alathra.AlathranWars.commands.CommandManager;
|
||||||
import com.github.alathra.AlathranWars.config.ConfigHandler;
|
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.DatabaseHandler;
|
||||||
import com.github.alathra.AlathranWars.db.DatabaseQueries;
|
import com.github.alathra.AlathranWars.db.DatabaseQueries;
|
||||||
import com.github.alathra.AlathranWars.hooks.HookManager;
|
import com.github.alathra.AlathranWars.hooks.HookManager;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.github.alathra.AlathranWars.commands;
|
package com.github.alathra.AlathranWars.commands;
|
||||||
|
|
||||||
import com.github.alathra.AlathranWars.AlathranWars;
|
import com.github.alathra.AlathranWars.AlathranWars;
|
||||||
import com.github.alathra.AlathranWars.conflict.Side;
|
import com.github.alathra.AlathranWars.conflict.war.side.Side;
|
||||||
import com.github.alathra.AlathranWars.conflict.War;
|
import com.github.alathra.AlathranWars.conflict.war.War;
|
||||||
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.conflict.battle.siege.Siege;
|
||||||
import com.github.alathra.AlathranWars.enums.CommandArgsSiege;
|
import com.github.alathra.AlathranWars.enums.CommandArgsSiege;
|
||||||
import com.github.alathra.AlathranWars.enums.CommandArgsWar;
|
import com.github.alathra.AlathranWars.enums.CommandArgsWar;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.github.alathra.AlathranWars.commands;
|
package com.github.alathra.AlathranWars.commands;
|
||||||
|
|
||||||
import com.github.alathra.AlathranWars.AlathranWars;
|
import com.github.alathra.AlathranWars.AlathranWars;
|
||||||
import com.github.alathra.AlathranWars.conflict.Side;
|
import com.github.alathra.AlathranWars.conflict.war.side.Side;
|
||||||
import com.github.alathra.AlathranWars.conflict.War;
|
import com.github.alathra.AlathranWars.conflict.war.War;
|
||||||
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.conflict.battle.siege.Siege;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.BattleVictoryReason;
|
import com.github.alathra.AlathranWars.enums.battle.BattleVictoryReason;
|
||||||
import com.github.alathra.AlathranWars.utility.UtilsChat;
|
import com.github.alathra.AlathranWars.utility.UtilsChat;
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package com.github.alathra.AlathranWars.commands;
|
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.hooks.NameColorHandler;
|
||||||
import com.github.alathra.AlathranWars.utility.UtilsChat;
|
import com.github.alathra.AlathranWars.utility.UtilsChat;
|
||||||
import com.github.milkdrinkers.colorparser.ColorParser;
|
import com.github.milkdrinkers.colorparser.ColorParser;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.github.alathra.AlathranWars.conflict.battle.raid;
|
package com.github.alathra.AlathranWars.conflict.battle.raid;
|
||||||
|
|
||||||
import com.github.alathra.AlathranWars.AlathranWars;
|
import com.github.alathra.AlathranWars.AlathranWars;
|
||||||
import com.github.alathra.AlathranWars.conflict.Side;
|
import com.github.alathra.AlathranWars.conflict.war.side.Side;
|
||||||
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.conflict.battle.Battle;
|
||||||
import com.github.alathra.AlathranWars.enums.CaptureProgressDirection;
|
import com.github.alathra.AlathranWars.enums.CaptureProgressDirection;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.*;
|
import com.github.alathra.AlathranWars.enums.battle.*;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.github.alathra.AlathranWars.conflict.battle.siege;
|
package com.github.alathra.AlathranWars.conflict.battle.siege;
|
||||||
|
|
||||||
import com.github.alathra.AlathranWars.AlathranWars;
|
import com.github.alathra.AlathranWars.AlathranWars;
|
||||||
import com.github.alathra.AlathranWars.conflict.Side;
|
import com.github.alathra.AlathranWars.conflict.war.side.Side;
|
||||||
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.conflict.battle.Battle;
|
||||||
import com.github.alathra.AlathranWars.db.DatabaseQueries;
|
import com.github.alathra.AlathranWars.db.DatabaseQueries;
|
||||||
import com.github.alathra.AlathranWars.enums.CaptureProgressDirection;
|
import com.github.alathra.AlathranWars.enums.CaptureProgressDirection;
|
||||||
|
|||||||
+13
-9
@@ -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.raid.Raid;
|
||||||
import com.github.alathra.AlathranWars.conflict.battle.siege.Siege;
|
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.db.DatabaseQueries;
|
||||||
import com.github.alathra.AlathranWars.enums.ConflictType;
|
import com.github.alathra.AlathranWars.enums.ConflictType;
|
||||||
import com.github.alathra.AlathranWars.enums.WarDeleteReason;
|
import com.github.alathra.AlathranWars.enums.WarDeleteReason;
|
||||||
@@ -47,7 +51,7 @@ public class War extends Conflict {
|
|||||||
private final ConflictType conflictType = ConflictType.WAR;
|
private final ConflictType conflictType = ConflictType.WAR;
|
||||||
private boolean event;
|
private boolean event;
|
||||||
|
|
||||||
private @NotNull Side side1;
|
private Side side1;
|
||||||
private Side side2;
|
private Side side2;
|
||||||
private final Side attacker; // Reference variable to side1 or side2
|
private final Side attacker; // Reference variable to side1 or side2
|
||||||
private final Side defender; // 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,
|
UUID uuid,
|
||||||
String name,
|
String name,
|
||||||
String label,
|
String label,
|
||||||
@NotNull Side side1,
|
Side side1,
|
||||||
Side side2,
|
Side side2,
|
||||||
Set<Siege> sieges,
|
Set<Siege> sieges,
|
||||||
Set<Raid> raids,
|
Set<Raid> raids,
|
||||||
@@ -127,14 +131,14 @@ public class War extends Conflict {
|
|||||||
.setLeader(aggressor)
|
.setLeader(aggressor)
|
||||||
.setSide(BattleSide.ATTACKER)
|
.setSide(BattleSide.ATTACKER)
|
||||||
.setTeam(BattleTeam.SIDE_1)
|
.setTeam(BattleTeam.SIDE_1)
|
||||||
.buildNew();
|
.build();
|
||||||
this.side2 = new SideBuilder()
|
this.side2 = new SideBuilder()
|
||||||
.setWarUUID(this.uuid)
|
.setWarUUID(this.uuid)
|
||||||
.setUuid(UUID.randomUUID())
|
.setUuid(UUID.randomUUID())
|
||||||
.setLeader(victim)
|
.setLeader(victim)
|
||||||
.setSide(BattleSide.DEFENDER)
|
.setSide(BattleSide.DEFENDER)
|
||||||
.setTeam(BattleTeam.SIDE_2)
|
.setTeam(BattleTeam.SIDE_2)
|
||||||
.buildNew();
|
.build();
|
||||||
|
|
||||||
this.attacker = side1.getSide().equals(BattleSide.ATTACKER) ? this.side1 : this.side2;
|
this.attacker = side1.getSide().equals(BattleSide.ATTACKER) ? this.side1 : this.side2;
|
||||||
this.defender = side1.getSide().equals(BattleSide.DEFENDER) ? 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
|
* @param war the war
|
||||||
* @return the boolean
|
* @return the boolean
|
||||||
*/
|
*/
|
||||||
public boolean equals(@NotNull War war) {
|
public boolean equals(War war) {
|
||||||
return this.uuid.equals(war.getUUID());
|
return this.uuid.equals(war.getUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -817,9 +821,9 @@ public class War extends Conflict {
|
|||||||
*
|
*
|
||||||
* @param loserSide the loser side
|
* @param loserSide the loser side
|
||||||
*/
|
*/
|
||||||
public void defeat(@NotNull Side loserSide) {
|
public void defeat(Side loserSide) {
|
||||||
@NotNull Side loser = loserSide.equals(getSide1()) ? getSide1() : getSide2();
|
Side loser = loserSide.equals(getSide1()) ? getSide1() : getSide2();
|
||||||
@NotNull Side winner = loserSide.equals(getSide1()) ? getSide2() : getSide1();
|
Side winner = loserSide.equals(getSide1()) ? getSide2() : getSide1();
|
||||||
|
|
||||||
Bukkit.broadcast(ColorParser.of(UtilsChat.getPrefix() + "The war of <war> has ended. <red><winner> <reset>has triumphed against <red><loser><reset>.")
|
Bukkit.broadcast(ColorParser.of(UtilsChat.getPrefix() + "The war of <war> has ended. <red><winner> <reset>has triumphed against <red><loser><reset>.")
|
||||||
.parseMinimessagePlaceholder("war", getLabel())
|
.parseMinimessagePlaceholder("war", getLabel())
|
||||||
+3
-35
@@ -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.raid.Raid;
|
||||||
import com.github.alathra.AlathranWars.conflict.battle.siege.Siege;
|
import com.github.alathra.AlathranWars.conflict.battle.siege.Siege;
|
||||||
import com.github.alathra.AlathranWars.enums.ConflictType;
|
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.Nation;
|
||||||
import com.palmergames.bukkit.towny.object.Town;
|
import com.palmergames.bukkit.towny.object.Town;
|
||||||
import dev.jorel.commandapi.exceptions.WrapperCommandSyntaxException;
|
import dev.jorel.commandapi.exceptions.WrapperCommandSyntaxException;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -25,11 +25,6 @@ public class WarBuilder {
|
|||||||
private Set<Siege> sieges = new HashSet<>();
|
private Set<Siege> sieges = new HashSet<>();
|
||||||
private Set<Raid> raids = new HashSet<>();
|
private Set<Raid> raids = new HashSet<>();
|
||||||
|
|
||||||
private Town aggressorTown;
|
|
||||||
private Optional<Nation> aggressorNation = Optional.empty();
|
|
||||||
private Town victimTown;
|
|
||||||
private Optional<Nation> victimNation = Optional.empty();
|
|
||||||
|
|
||||||
private Government aggressor;
|
private Government aggressor;
|
||||||
private Government victim;
|
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 {
|
public War create() throws WrapperCommandSyntaxException, SideCreationException {
|
||||||
this.setUuid(UUID.randomUUID());
|
this.setUuid(UUID.randomUUID());
|
||||||
|
|
||||||
@@ -139,24 +113,18 @@ public class WarBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public WarBuilder setAggressorTown(Town target) {
|
public WarBuilder setAggressorTown(Town target) {
|
||||||
this.aggressorTown = target;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WarBuilder setAggressorNation(Nation target) {
|
public WarBuilder setAggressorNation(Nation target) {
|
||||||
this.aggressorTown = target.getCapital();
|
|
||||||
this.aggressorNation = Optional.of(target);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WarBuilder setVictimTown(Town target) {
|
public WarBuilder setVictimTown(Town target) {
|
||||||
this.victimTown = target;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WarBuilder setVictimNation(Nation target) {
|
public WarBuilder setVictimNation(Nation target) {
|
||||||
this.victimTown = target.getCapital();
|
|
||||||
this.victimNation = Optional.of(target);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
+216
-21
@@ -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.raid.Raid;
|
||||||
import com.github.alathra.AlathranWars.conflict.battle.siege.Siege;
|
import com.github.alathra.AlathranWars.conflict.battle.siege.Siege;
|
||||||
import com.github.alathra.AlathranWars.db.DatabaseQueries;
|
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 com.palmergames.bukkit.towny.object.Town;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@@ -17,6 +19,9 @@ import java.util.Set;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The singleton War controller.
|
||||||
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class WarController {
|
public class WarController {
|
||||||
private static WarController instance;
|
private static WarController instance;
|
||||||
@@ -27,6 +32,11 @@ public class WarController {
|
|||||||
Bukkit.getServer().getLogger().warning("Tried to re-initialize singleton");
|
Bukkit.getServer().getLogger().warning("Tried to re-initialize singleton");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets or creates an instance of the war controller.
|
||||||
|
*
|
||||||
|
* @return the instance
|
||||||
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static WarController getInstance() {
|
public static WarController getInstance() {
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
@@ -35,128 +45,264 @@ public class WarController {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load all wars into memory from database.
|
||||||
|
*/
|
||||||
|
@ApiStatus.Internal
|
||||||
public void loadAll() {
|
public void loadAll() {
|
||||||
wars = DatabaseQueries.loadAll();
|
wars = DatabaseQueries.loadAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all wars.
|
||||||
|
*
|
||||||
|
* @return the wars
|
||||||
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public Set<War> getWars() {
|
public Set<War> getWars() {
|
||||||
return wars;
|
return wars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets war by its name or returns null.
|
||||||
|
*
|
||||||
|
* @param warName the war name
|
||||||
|
* @return the war
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public War getWar(String warName) {
|
public War getWar(String warName) {
|
||||||
for (@NotNull War war : getWars())
|
return getWars().stream()
|
||||||
if (war.equals(warName)) return war;
|
.filter(war -> war.equals(warName))
|
||||||
|
.findAny()
|
||||||
return null;
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets war by its UUID or returns null.
|
||||||
|
*
|
||||||
|
* @param uuid the uuid
|
||||||
|
* @return the war
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public War getWar(UUID uuid) {
|
public War getWar(UUID uuid) {
|
||||||
for (@NotNull War war : getWars())
|
return getWars().stream()
|
||||||
if (war.equals(uuid)) return war;
|
.filter(war -> war.equals(uuid))
|
||||||
|
.findAny()
|
||||||
return null;
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets side by the side UUID.
|
||||||
|
*
|
||||||
|
* @param uuid the uuid
|
||||||
|
* @return the side
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public Side getSide(UUID uuid) {
|
public Side getSide(UUID uuid) {
|
||||||
for (@NotNull War war : getWars())
|
return getWars().stream()
|
||||||
if (war.getSide(uuid) != null) return war.getSide(uuid);
|
.filter(war -> war.getSide(uuid) != null)
|
||||||
|
.map(war -> war.getSide(uuid))
|
||||||
return null;
|
.findAny()
|
||||||
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets siege by the siege UUID.
|
||||||
|
*
|
||||||
|
* @param uuid the uuid
|
||||||
|
* @return the siege
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public Siege getSiege(UUID uuid) {
|
public Siege getSiege(UUID uuid) {
|
||||||
for (@NotNull War war : getWars())
|
return getWars().stream()
|
||||||
if (war.getSiege(uuid) != null) return war.getSiege(uuid);
|
.filter(war -> war.getSiege(uuid) != null)
|
||||||
|
.map(war -> war.getSiege(uuid))
|
||||||
return null;
|
.findAny()
|
||||||
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a war to the war controller.
|
||||||
|
*
|
||||||
|
* @param war the war
|
||||||
|
*/
|
||||||
|
@ApiStatus.Internal
|
||||||
public void addWar(War war) {
|
public void addWar(War war) {
|
||||||
getWars().add(war);
|
getWars().add(war);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a war from the war controller.
|
||||||
|
*
|
||||||
|
* @param war the war
|
||||||
|
*/
|
||||||
|
@ApiStatus.Internal
|
||||||
public void removeWar(War war) {
|
public void removeWar(War war) {
|
||||||
getWars().remove(war);
|
getWars().remove(war);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is player in any wars. Includes if surrendered.
|
||||||
|
*
|
||||||
|
* @param uuid the uuid
|
||||||
|
* @return the boolean
|
||||||
|
*/
|
||||||
public boolean isPlayerInAnyWars(UUID uuid) {
|
public boolean isPlayerInAnyWars(UUID uuid) {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
.anyMatch(war -> war.isPlayerInWar(uuid));
|
.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());
|
return isPlayerInAnyWars(p.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull Set<War> getPlayerWars(@NotNull Player p) {
|
/**
|
||||||
|
* Gets list of player wars. Includes if surrendered.
|
||||||
|
*
|
||||||
|
* @param p the p
|
||||||
|
* @return the player wars
|
||||||
|
*/
|
||||||
|
public @NotNull Set<War> getPlayerWars(Player p) {
|
||||||
return getPlayerWars(p.getUniqueId());
|
return getPlayerWars(p.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets list of player wars. Includes if surrendered.
|
||||||
|
*
|
||||||
|
* @param uuid the uuid
|
||||||
|
* @return the player wars
|
||||||
|
*/
|
||||||
public @NotNull Set<War> getPlayerWars(UUID uuid) {
|
public @NotNull Set<War> getPlayerWars(UUID uuid) {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
.filter(war -> war.isPlayerInWar(uuid))
|
.filter(war -> war.isPlayerInWar(uuid))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is town in any wars. Includes surrendered towns.
|
||||||
|
*
|
||||||
|
* @param town the town
|
||||||
|
* @return the boolean
|
||||||
|
*/
|
||||||
public boolean isTownInAnyWars(Town town) {
|
public boolean isTownInAnyWars(Town town) {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
.anyMatch(war -> war.isTownInWar(town));
|
.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) {
|
public boolean isTownInAnySieges(Town town) {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
.anyMatch(war -> war.isTownInWar(town) && war.isTownUnderSiege(town));
|
.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) {
|
public boolean isTownInAnyRaids(Town town) {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
.anyMatch(war -> war.isTownInWar(town) && war.isTownUnderRaid(town));
|
.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) {
|
public boolean isNationInAnySieges(Nation nation) {
|
||||||
return nation.getTowns().stream()
|
return nation.getTowns().stream()
|
||||||
.anyMatch(this::isTownInAnySieges);
|
.anyMatch(this::isTownInAnySieges);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is nation in any raids. Includes surrendered nations.
|
||||||
|
*
|
||||||
|
* @param nation the nation
|
||||||
|
* @return the boolean
|
||||||
|
*/
|
||||||
public boolean isNationInAnyRaids(Nation nation) {
|
public boolean isNationInAnyRaids(Nation nation) {
|
||||||
return nation.getTowns().stream()
|
return nation.getTowns().stream()
|
||||||
.anyMatch(this::isTownInAnyRaids);
|
.anyMatch(this::isTownInAnyRaids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets town sieges. Includes surrendered towns.
|
||||||
|
*
|
||||||
|
* @param town the town
|
||||||
|
* @return the town sieges
|
||||||
|
*/
|
||||||
public @NotNull Set<Siege> getTownSieges(Town town) {
|
public @NotNull Set<Siege> getTownSieges(Town town) {
|
||||||
return getSieges().stream()
|
return getSieges().stream()
|
||||||
.filter(siege -> siege.getAttackerSide().isTownOnSide(town) || siege.getDefenderSide().isTownOnSide(town))
|
.filter(siege -> siege.getAttackerSide().isTownOnSide(town) || siege.getDefenderSide().isTownOnSide(town))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets town raids. Includes surrendered towns.
|
||||||
|
*
|
||||||
|
* @param town the town
|
||||||
|
* @return the town raids
|
||||||
|
*/
|
||||||
public @NotNull Set<Raid> getTownRaids(Town town) {
|
public @NotNull Set<Raid> getTownRaids(Town town) {
|
||||||
return getRaids().stream()
|
return getRaids().stream()
|
||||||
.filter(raid -> raid.getAttackerSide().isTownOnSide(town) || raid.getDefenderSide().isTownOnSide(town))
|
.filter(raid -> raid.getAttackerSide().isTownOnSide(town) || raid.getDefenderSide().isTownOnSide(town))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets town wars. Includes surrendered towns.
|
||||||
|
*
|
||||||
|
* @param town the town
|
||||||
|
* @return the town wars
|
||||||
|
*/
|
||||||
public @NotNull Set<War> getTownWars(Town town) {
|
public @NotNull Set<War> getTownWars(Town town) {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
.filter(war -> war.isTownInWar(town))
|
.filter(war -> war.isTownInWar(town))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is nation in any wars. Includes surrendered nations.
|
||||||
|
*
|
||||||
|
* @param nation the nation
|
||||||
|
* @return the boolean
|
||||||
|
*/
|
||||||
public boolean isNationInAnyWars(Nation nation) {
|
public boolean isNationInAnyWars(Nation nation) {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
.anyMatch(war -> war.isNationInWar(nation));
|
.anyMatch(war -> war.isNationInWar(nation));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets nation wars. Includes surrendered nations.
|
||||||
|
*
|
||||||
|
* @param nation the nation
|
||||||
|
* @return the nation wars
|
||||||
|
*/
|
||||||
public @NotNull Set<War> getNationWars(Nation nation) {
|
public @NotNull Set<War> getNationWars(Nation nation) {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
.filter(war -> war.isNationInWar(nation))
|
.filter(war -> war.isNationInWar(nation))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of war names.
|
||||||
|
*
|
||||||
|
* @return the war names
|
||||||
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<String> getWarNames() {
|
public List<String> getWarNames() {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
@@ -165,6 +311,11 @@ public class WarController {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of war labels.
|
||||||
|
*
|
||||||
|
* @return the war labels
|
||||||
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<String> getWarLabels() {
|
public List<String> getWarLabels() {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
@@ -173,6 +324,11 @@ public class WarController {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of all active sieges.
|
||||||
|
*
|
||||||
|
* @return the sieges
|
||||||
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public Set<Siege> getSieges() {
|
public Set<Siege> getSieges() {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
@@ -181,6 +337,11 @@ public class WarController {
|
|||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of all active raids.
|
||||||
|
*
|
||||||
|
* @return the raids
|
||||||
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public Set<Raid> getRaids() {
|
public Set<Raid> getRaids() {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
@@ -189,25 +350,54 @@ public class WarController {
|
|||||||
.collect(Collectors.toSet());
|
.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());
|
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) {
|
public boolean isPlayerInAnySiege(UUID uuid) {
|
||||||
return getSieges().stream()
|
return getSieges().stream()
|
||||||
.anyMatch(siege -> siege.isPlayerInSiege(uuid));
|
.anyMatch(siege -> siege.isPlayerInSiege(uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull Set<Siege> getPlayerSieges(@NotNull Player p) {
|
/**
|
||||||
|
* Gets player sieges.
|
||||||
|
*
|
||||||
|
* @param p the p
|
||||||
|
* @return the player sieges
|
||||||
|
*/
|
||||||
|
public @NotNull Set<Siege> getPlayerSieges(Player p) {
|
||||||
return getPlayerSieges(p.getUniqueId());
|
return getPlayerSieges(p.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets player sieges. Returns true for offline players.
|
||||||
|
*
|
||||||
|
* @param uuid the uuid
|
||||||
|
* @return the player sieges
|
||||||
|
*/
|
||||||
public @NotNull Set<Siege> getPlayerSieges(UUID uuid) {
|
public @NotNull Set<Siege> getPlayerSieges(UUID uuid) {
|
||||||
return getSieges().stream()
|
return getSieges().stream()
|
||||||
.filter(siege -> siege.isPlayerInSiege(uuid))
|
.filter(siege -> siege.isPlayerInSiege(uuid))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets nations at war. Does not include surrendered nations.
|
||||||
|
*
|
||||||
|
* @return the nations at war
|
||||||
|
*/
|
||||||
public @NotNull Set<Nation> getNationsAtWar() {
|
public @NotNull Set<Nation> getNationsAtWar() {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
.map(War::getNations)
|
.map(War::getNations)
|
||||||
@@ -215,6 +405,11 @@ public class WarController {
|
|||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets towns at war. Does not include surrendered towns.
|
||||||
|
*
|
||||||
|
* @return the towns at war
|
||||||
|
*/
|
||||||
public @NotNull Set<Town> getTownsAtWar() {
|
public @NotNull Set<Town> getTownsAtWar() {
|
||||||
return getWars().stream()
|
return getWars().stream()
|
||||||
.map(War::getTowns)
|
.map(War::getTowns)
|
||||||
+3
-1
@@ -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 class WarCreationException extends SideCreationException {
|
||||||
public WarCreationException(String errorMessage) {
|
public WarCreationException(String errorMessage) {
|
||||||
+28
-95
@@ -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.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.BattleSide;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.BattleTeam;
|
import com.github.alathra.AlathranWars.enums.battle.BattleTeam;
|
||||||
import com.github.alathra.AlathranWars.hooks.NameColorHandler;
|
import com.github.alathra.AlathranWars.hooks.NameColorHandler;
|
||||||
@@ -89,31 +91,6 @@ public class Side {
|
|||||||
calculateOnlinePlayers();
|
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 {
|
public Side(UUID warUUID, UUID uuid, Government government, BattleSide side, BattleTeam team) throws SideCreationException {
|
||||||
this.warUUID = warUUID;
|
this.warUUID = warUUID;
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
@@ -144,50 +121,6 @@ public class Side {
|
|||||||
calculateOnlinePlayers();
|
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() {
|
public BattleSide getSide() {
|
||||||
return side;
|
return side;
|
||||||
}
|
}
|
||||||
@@ -246,7 +179,7 @@ public class Side {
|
|||||||
return surrenderedNations.contains(nation);
|
return surrenderedNations.contains(nation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTown(@NotNull Town town) {
|
public void addTown(Town town) {
|
||||||
if (isTownOnSide(town)) return;
|
if (isTownOnSide(town)) return;
|
||||||
|
|
||||||
towns.add(town);
|
towns.add(town);
|
||||||
@@ -254,7 +187,7 @@ public class Side {
|
|||||||
town.getResidents().forEach((Resident resident) -> addPlayer(resident.getUUID()));
|
town.getResidents().forEach((Resident resident) -> addPlayer(resident.getUUID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNation(@NotNull Nation nation) {
|
public void addNation(Nation nation) {
|
||||||
if (isNationOnSide(nation)) return;
|
if (isNationOnSide(nation)) return;
|
||||||
|
|
||||||
nations.add(nation);
|
nations.add(nation);
|
||||||
@@ -262,7 +195,7 @@ public class Side {
|
|||||||
nation.getTowns().forEach(this::addTown);
|
nation.getTowns().forEach(this::addTown);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeTown(@NotNull Town town) {
|
public void removeTown(Town town) {
|
||||||
if (!isTownOnSide(town)) return;
|
if (!isTownOnSide(town)) return;
|
||||||
|
|
||||||
towns.remove(town);
|
towns.remove(town);
|
||||||
@@ -270,7 +203,7 @@ public class Side {
|
|||||||
town.getResidents().forEach((Resident resident) -> removePlayer(resident.getUUID()));
|
town.getResidents().forEach((Resident resident) -> removePlayer(resident.getUUID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeNation(@NotNull Nation nation) {
|
public void removeNation(Nation nation) {
|
||||||
if (!isNationOnSide(nation)) return;
|
if (!isNationOnSide(nation)) return;
|
||||||
|
|
||||||
nations.remove(nation);
|
nations.remove(nation);
|
||||||
@@ -278,7 +211,7 @@ public class Side {
|
|||||||
nation.getTowns().forEach(this::removeTown);
|
nation.getTowns().forEach(this::removeTown);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void surrenderTown(@NotNull Town town) {
|
public void surrenderTown(Town town) {
|
||||||
if (isTownSurrendered(town)) return;
|
if (isTownSurrendered(town)) return;
|
||||||
|
|
||||||
removeTown(town);
|
removeTown(town);
|
||||||
@@ -288,7 +221,7 @@ public class Side {
|
|||||||
town.getResidents().forEach((Resident resident) -> surrenderPlayer(resident.getUUID()));
|
town.getResidents().forEach((Resident resident) -> surrenderPlayer(resident.getUUID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void surrenderNation(@NotNull Nation nation) {
|
public void surrenderNation(Nation nation) {
|
||||||
if (isNationSurrendered(nation)) return;
|
if (isNationSurrendered(nation)) return;
|
||||||
|
|
||||||
removeNation(nation);
|
removeNation(nation);
|
||||||
@@ -298,7 +231,7 @@ public class Side {
|
|||||||
nation.getTowns().forEach(this::surrenderTown);
|
nation.getTowns().forEach(this::surrenderTown);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unsurrenderTown(@NotNull Town town) {
|
public void unsurrenderTown(Town town) {
|
||||||
if (!isTownSurrendered(town)) return;
|
if (!isTownSurrendered(town)) return;
|
||||||
|
|
||||||
addTown(town);
|
addTown(town);
|
||||||
@@ -308,7 +241,7 @@ public class Side {
|
|||||||
town.getResidents().forEach((Resident resident) -> unsurrenderPlayer(resident.getUUID()));
|
town.getResidents().forEach((Resident resident) -> unsurrenderPlayer(resident.getUUID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unsurrenderNation(@NotNull Nation nation) {
|
public void unsurrenderNation(Nation nation) {
|
||||||
if (!isNationSurrendered(nation)) return;
|
if (!isNationSurrendered(nation)) return;
|
||||||
|
|
||||||
addNation(nation);
|
addNation(nation);
|
||||||
@@ -318,7 +251,7 @@ public class Side {
|
|||||||
nation.getTowns().forEach(this::unsurrenderTown);
|
nation.getTowns().forEach(this::unsurrenderTown);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlayerOnSide(@NotNull Player p) {
|
public boolean isPlayerOnSide(Player p) {
|
||||||
return isPlayerOnSide(p.getUniqueId());
|
return isPlayerOnSide(p.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,7 +259,7 @@ public class Side {
|
|||||||
return playersIncludingOffline.contains(uuid) || surrenderedPlayersIncludingOffline.contains(uuid);
|
return playersIncludingOffline.contains(uuid) || surrenderedPlayersIncludingOffline.contains(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlayerSurrendered(@NotNull Player p) {
|
public boolean isPlayerSurrendered(Player p) {
|
||||||
return isPlayerSurrendered(p.getUniqueId());
|
return isPlayerSurrendered(p.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,21 +267,21 @@ public class Side {
|
|||||||
return surrenderedPlayersIncludingOffline.contains(uuid);
|
return surrenderedPlayersIncludingOffline.contains(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayer(@NotNull Player p) {
|
public void addPlayer(Player p) {
|
||||||
addPlayer(p.getUniqueId());
|
addPlayer(p.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayer(@NotNull OfflinePlayer offlinePlayer) {
|
public void addPlayer(OfflinePlayer offlinePlayer) {
|
||||||
if (offlinePlayer.hasPlayedBefore())
|
if (offlinePlayer.hasPlayedBefore())
|
||||||
addPlayer(offlinePlayer.getUniqueId());
|
addPlayer(offlinePlayer.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayer(@NotNull UUID uuid) {
|
public void addPlayer(UUID uuid) {
|
||||||
if (isPlayerOnSide(uuid)) return;
|
if (isPlayerOnSide(uuid)) return;
|
||||||
|
|
||||||
playersIncludingOffline.add(uuid);
|
playersIncludingOffline.add(uuid);
|
||||||
if (getWar() != null) { // We need to check this as on side creation War doesn't exist
|
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)) {
|
if (siege.getAttackerSide().equals(this)) {
|
||||||
siege.addPlayer(uuid, BattleSide.ATTACKER);
|
siege.addPlayer(uuid, BattleSide.ATTACKER);
|
||||||
} else {
|
} else {
|
||||||
@@ -367,21 +300,21 @@ public class Side {
|
|||||||
players.add(p);
|
players.add(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePlayer(@NotNull Player p) {
|
public void removePlayer(Player p) {
|
||||||
removePlayer(p.getUniqueId());
|
removePlayer(p.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePlayer(@NotNull OfflinePlayer offlinePlayer) {
|
public void removePlayer(OfflinePlayer offlinePlayer) {
|
||||||
if (offlinePlayer.hasPlayedBefore())
|
if (offlinePlayer.hasPlayedBefore())
|
||||||
removePlayer(offlinePlayer.getUniqueId());
|
removePlayer(offlinePlayer.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePlayer(@NotNull UUID uuid) {
|
public void removePlayer(UUID uuid) {
|
||||||
if (!isPlayerOnSide(uuid)) return;
|
if (!isPlayerOnSide(uuid)) return;
|
||||||
|
|
||||||
playersIncludingOffline.remove(uuid);
|
playersIncludingOffline.remove(uuid);
|
||||||
if (getWar() != null) { // We need to check this as on side creation War doesn't exist
|
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)) {
|
if (siege.getAttackerSide().equals(this)) {
|
||||||
siege.removePlayer(uuid);
|
siege.removePlayer(uuid);
|
||||||
} else {
|
} else {
|
||||||
@@ -400,11 +333,11 @@ public class Side {
|
|||||||
players.remove(p);
|
players.remove(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void surrenderPlayer(@NotNull Player p) {
|
public void surrenderPlayer(Player p) {
|
||||||
surrenderPlayer(p.getUniqueId());
|
surrenderPlayer(p.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void surrenderPlayer(@NotNull UUID uuid) {
|
public void surrenderPlayer(UUID uuid) {
|
||||||
if (isPlayerSurrendered(uuid)) return;
|
if (isPlayerSurrendered(uuid)) return;
|
||||||
|
|
||||||
removePlayer(uuid);
|
removePlayer(uuid);
|
||||||
@@ -412,11 +345,11 @@ public class Side {
|
|||||||
applyNameTags();
|
applyNameTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unsurrenderPlayer(@NotNull Player p) {
|
public void unsurrenderPlayer(Player p) {
|
||||||
unsurrenderPlayer(p.getUniqueId());
|
unsurrenderPlayer(p.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unsurrenderPlayer(@NotNull UUID uuid) {
|
public void unsurrenderPlayer(UUID uuid) {
|
||||||
if (!isPlayerSurrendered(uuid)) return;
|
if (!isPlayerSurrendered(uuid)) return;
|
||||||
|
|
||||||
addPlayer(uuid);
|
addPlayer(uuid);
|
||||||
@@ -425,7 +358,7 @@ public class Side {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void calculateOnlinePlayers() {
|
public void calculateOnlinePlayers() {
|
||||||
final @NotNull Set<Player> onlinePlayers = getPlayersIncludingOffline().stream()
|
final Set<Player> onlinePlayers = getPlayersIncludingOffline().stream()
|
||||||
.filter(uuid -> Bukkit.getOfflinePlayer(uuid).isOnline())
|
.filter(uuid -> Bukkit.getOfflinePlayer(uuid).isOnline())
|
||||||
.map(Bukkit::getPlayer)
|
.map(Bukkit::getPlayer)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
@@ -499,11 +432,11 @@ public class Side {
|
|||||||
return this.uuid.equals(uuid);
|
return this.uuid.equals(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(@NotNull War war) {
|
public boolean equals(War war) {
|
||||||
return this.warUUID.equals(war.getUUID());
|
return this.warUUID.equals(war.getUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(@NotNull Side side) {
|
public boolean equals(Side side) {
|
||||||
return getUUID().equals(side.getUUID());
|
return getUUID().equals(side.getUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
+21
-26
@@ -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.BattleSide;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.BattleTeam;
|
import com.github.alathra.AlathranWars.enums.battle.BattleTeam;
|
||||||
import com.palmergames.bukkit.towny.object.Government;
|
import com.palmergames.bukkit.towny.object.Government;
|
||||||
import com.palmergames.bukkit.towny.object.Nation;
|
import com.palmergames.bukkit.towny.object.Nation;
|
||||||
import com.palmergames.bukkit.towny.object.Town;
|
import com.palmergames.bukkit.towny.object.Town;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class SideBuilder {
|
public class SideBuilder {
|
||||||
|
private UUID warUUID;
|
||||||
|
private UUID uuid;
|
||||||
|
private BattleSide side;
|
||||||
|
private BattleTeam team;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Government government;
|
||||||
|
|
||||||
|
private Set<Town> towns;
|
||||||
|
private Set<Nation> nations;
|
||||||
|
private Set<UUID> playersIncludingOffline;
|
||||||
|
private Set<Town> surrenderedTowns;
|
||||||
|
private Set<Nation> surrenderedNations;
|
||||||
|
private Set<UUID> surrenderedPlayersIncludingOffline;
|
||||||
|
private Instant siegeGrace;
|
||||||
|
private Instant raidGrace;
|
||||||
|
|
||||||
public SideBuilder() {}
|
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 ||
|
// if (warUUID == null || uuid == null || town == null || side == null || team == null || name == null ||
|
||||||
// towns == null || nations == null || playersIncludingOffline == null ||
|
// towns == null || nations == null || playersIncludingOffline == null ||
|
||||||
// surrenderedTowns == null || surrenderedNations == null || surrenderedPlayersIncludingOffline == null ||
|
// surrenderedTowns == null || surrenderedNations == null || surrenderedPlayersIncludingOffline == null ||
|
||||||
// siegeGrace == null || raidGrace == null
|
// siegeGrace == null || raidGrace == null
|
||||||
// ) throw new IllegalStateException("Missing state to create Side 1");
|
// ) throw new IllegalStateException("Missing state to create Side 1");
|
||||||
|
// TODO Cleanup this shit
|
||||||
if (warUUID == null || uuid == null
|
if (warUUID == null || uuid == null
|
||||||
) throw new IllegalStateException("Missing state to create Side 1.2");
|
) 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)
|
if (warUUID == null || uuid == null || government == null || side == null || team == null)
|
||||||
throw new IllegalStateException("Missing state to create new Side");
|
throw new IllegalStateException("Missing state to create new Side");
|
||||||
|
|
||||||
@@ -138,25 +154,4 @@ public class SideBuilder {
|
|||||||
this.raidGrace = raidGrace;
|
this.raidGrace = raidGrace;
|
||||||
return this;
|
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<Town> towns;
|
|
||||||
private Set<Nation> nations;
|
|
||||||
private Set<UUID> playersIncludingOffline;
|
|
||||||
private Set<Town> surrenderedTowns;
|
|
||||||
private Set<Nation> surrenderedNations;
|
|
||||||
private Set<UUID> surrenderedPlayersIncludingOffline;
|
|
||||||
private Instant siegeGrace;
|
|
||||||
private Instant raidGrace;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.github.alathra.AlathranWars.conflict;
|
package com.github.alathra.AlathranWars.conflict.war.side;
|
||||||
|
|
||||||
public class SideCreationException extends Exception {
|
public class SideCreationException extends Exception {
|
||||||
public SideCreationException(String errorMessage) {
|
public SideCreationException(String errorMessage) {
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
package com.github.alathra.AlathranWars.db;
|
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.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.BattleSide;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.BattleTeam;
|
import com.github.alathra.AlathranWars.enums.battle.BattleTeam;
|
||||||
import com.github.alathra.AlathranWars.utility.DB;
|
import com.github.alathra.AlathranWars.utility.DB;
|
||||||
@@ -456,7 +461,7 @@ public abstract class DatabaseQueries {
|
|||||||
.setSurrenderedPlayersIncludingOffline(playersSurrendered)
|
.setSurrenderedPlayersIncludingOffline(playersSurrendered)
|
||||||
.setSiegeGrace(siegeGrace)
|
.setSiegeGrace(siegeGrace)
|
||||||
.setRaidGrace(raidGrace)
|
.setRaidGrace(raidGrace)
|
||||||
.buildOld();
|
.rebuild();
|
||||||
} catch (SideCreationException e) {
|
} catch (SideCreationException e) {
|
||||||
Logger.get().error("SQL Query threw an error!", e);
|
Logger.get().error("SQL Query threw an error!", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.github.alathra.AlathranWars.events;
|
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.Cancellable;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.github.alathra.AlathranWars.events;
|
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 com.github.alathra.AlathranWars.enums.WarDeleteReason;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.github.alathra.AlathranWars.events;
|
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.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.github.alathra.AlathranWars.events;
|
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 com.github.alathra.AlathranWars.enums.WarDeleteReason;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.github.alathra.AlathranWars.events.battle;
|
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.conflict.battle.Battle;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.BattleVictor;
|
import com.github.alathra.AlathranWars.enums.battle.BattleVictor;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.BattleVictoryReason;
|
import com.github.alathra.AlathranWars.enums.battle.BattleVictoryReason;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.github.alathra.AlathranWars.events.battle;
|
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.conflict.battle.Battle;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package com.github.alathra.AlathranWars.events.battle;
|
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.conflict.battle.Battle;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.BattleType;
|
import com.github.alathra.AlathranWars.enums.battle.BattleType;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.BattleVictor;
|
import com.github.alathra.AlathranWars.enums.battle.BattleVictor;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package com.github.alathra.AlathranWars.events.battle;
|
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.conflict.battle.Battle;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.BattleType;
|
import com.github.alathra.AlathranWars.enums.battle.BattleType;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.github.alathra.AlathranWars.hooks;
|
package com.github.alathra.AlathranWars.hooks;
|
||||||
|
|
||||||
import com.github.alathra.AlathranWars.conflict.War;
|
import com.github.alathra.AlathranWars.conflict.war.War;
|
||||||
import com.github.alathra.AlathranWars.conflict.WarController;
|
import com.github.alathra.AlathranWars.conflict.war.WarController;
|
||||||
import com.github.alathra.AlathranWars.utility.Logger;
|
import com.github.alathra.AlathranWars.utility.Logger;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.github.alathra.AlathranWars.listeners;
|
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.conflict.battle.siege.Siege;
|
||||||
import com.github.alathra.AlathranWars.utility.Utils;
|
import com.github.alathra.AlathranWars.utility.Utils;
|
||||||
import com.github.alathra.AlathranWars.utility.UtilsChat;
|
import com.github.alathra.AlathranWars.utility.UtilsChat;
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
package com.github.alathra.AlathranWars.listeners.items;
|
package com.github.alathra.AlathranWars.listeners.items;
|
||||||
|
|
||||||
import com.github.alathra.AlathranWars.AlathranWars;
|
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.conflict.battle.siege.Siege;
|
||||||
import com.github.alathra.AlathranWars.items.WarItemRegistry;
|
import com.github.alathra.AlathranWars.items.WarItemRegistry;
|
||||||
import com.github.alathra.AlathranWars.utility.UtilsChat;
|
import com.github.alathra.AlathranWars.utility.UtilsChat;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package com.github.alathra.AlathranWars.listeners.siege;
|
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.conflict.battle.siege.Siege;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.BattleSide;
|
import com.github.alathra.AlathranWars.enums.battle.BattleSide;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package com.github.alathra.AlathranWars.listeners.siege;
|
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.conflict.battle.siege.Siege;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.BattleSide;
|
import com.github.alathra.AlathranWars.enums.battle.BattleSide;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.github.alathra.AlathranWars.listeners.siege;
|
package com.github.alathra.AlathranWars.listeners.siege;
|
||||||
|
|
||||||
import com.github.alathra.AlathranWars.conflict.Side;
|
import com.github.alathra.AlathranWars.conflict.war.side.Side;
|
||||||
import com.github.alathra.AlathranWars.conflict.War;
|
import com.github.alathra.AlathranWars.conflict.war.War;
|
||||||
import com.github.alathra.AlathranWars.conflict.battle.siege.Siege;
|
import com.github.alathra.AlathranWars.conflict.battle.siege.Siege;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.BattleType;
|
import com.github.alathra.AlathranWars.enums.battle.BattleType;
|
||||||
import com.github.alathra.AlathranWars.enums.battle.BattleVictoryReason;
|
import com.github.alathra.AlathranWars.enums.battle.BattleVictoryReason;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.github.alathra.AlathranWars.listeners.war;
|
package com.github.alathra.AlathranWars.listeners.war;
|
||||||
|
|
||||||
import com.github.alathra.AlathranWars.conflict.Side;
|
import com.github.alathra.AlathranWars.conflict.war.side.Side;
|
||||||
import com.github.alathra.AlathranWars.conflict.War;
|
import com.github.alathra.AlathranWars.conflict.war.War;
|
||||||
import com.github.alathra.AlathranWars.conflict.WarController;
|
import com.github.alathra.AlathranWars.conflict.war.WarController;
|
||||||
import com.github.alathra.AlathranWars.hooks.NameColorHandler;
|
import com.github.alathra.AlathranWars.hooks.NameColorHandler;
|
||||||
import com.palmergames.bukkit.towny.event.NationAddTownEvent;
|
import com.palmergames.bukkit.towny.event.NationAddTownEvent;
|
||||||
import com.palmergames.bukkit.towny.event.NationPreRenameEvent;
|
import com.palmergames.bukkit.towny.event.NationPreRenameEvent;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.github.alathra.AlathranWars.listeners.war;
|
package com.github.alathra.AlathranWars.listeners.war;
|
||||||
|
|
||||||
import com.github.alathra.AlathranWars.conflict.Side;
|
import com.github.alathra.AlathranWars.conflict.war.side.Side;
|
||||||
import com.github.alathra.AlathranWars.conflict.War;
|
import com.github.alathra.AlathranWars.conflict.war.War;
|
||||||
import com.github.alathra.AlathranWars.conflict.WarController;
|
import com.github.alathra.AlathranWars.conflict.war.WarController;
|
||||||
import com.github.alathra.AlathranWars.hooks.NameColorHandler;
|
import com.github.alathra.AlathranWars.hooks.NameColorHandler;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.github.alathra.AlathranWars.listeners.war;
|
package com.github.alathra.AlathranWars.listeners.war;
|
||||||
|
|
||||||
import com.github.alathra.AlathranWars.conflict.Side;
|
import com.github.alathra.AlathranWars.conflict.war.side.Side;
|
||||||
import com.github.alathra.AlathranWars.conflict.War;
|
import com.github.alathra.AlathranWars.conflict.war.War;
|
||||||
import com.github.alathra.AlathranWars.conflict.WarController;
|
import com.github.alathra.AlathranWars.conflict.war.WarController;
|
||||||
import com.github.alathra.AlathranWars.hooks.NameColorHandler;
|
import com.github.alathra.AlathranWars.hooks.NameColorHandler;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.github.alathra.AlathranWars.listeners.war;
|
package com.github.alathra.AlathranWars.listeners.war;
|
||||||
|
|
||||||
import com.github.alathra.AlathranWars.conflict.Side;
|
import com.github.alathra.AlathranWars.conflict.war.side.Side;
|
||||||
import com.github.alathra.AlathranWars.conflict.War;
|
import com.github.alathra.AlathranWars.conflict.war.War;
|
||||||
import com.github.alathra.AlathranWars.conflict.WarController;
|
import com.github.alathra.AlathranWars.conflict.war.WarController;
|
||||||
import com.github.alathra.AlathranWars.hooks.NameColorHandler;
|
import com.github.alathra.AlathranWars.hooks.NameColorHandler;
|
||||||
import com.github.milkdrinkers.colorparser.ColorParser;
|
import com.github.milkdrinkers.colorparser.ColorParser;
|
||||||
import com.palmergames.bukkit.towny.event.TownAddResidentEvent;
|
import com.palmergames.bukkit.towny.event.TownAddResidentEvent;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.github.alathra.AlathranWars.utility;
|
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.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.github.alathra.AlathranWars.utility;
|
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.github.alathra.AlathranWars.conflict.battle.siege.Siege;
|
||||||
import com.palmergames.bukkit.towny.object.WorldCoord;
|
import com.palmergames.bukkit.towny.object.WorldCoord;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|||||||
Reference in new issue
Block a user