style: reformat project

This commit is contained in:
darksaid98 committed 2024-02-03 06:13:15 +01:00
1 parent eecff93f3f
commit 038b94f01d
27 files changed
+55 -35

No files matched your search

@@ -1,10 +1,10 @@
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.war.side.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.War;
import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.conflict.war.WarController;
import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; import com.github.alathra.AlathranWars.conflict.war.side.Side;
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;
import com.github.alathra.AlathranWars.hooks.TownyHook; import com.github.alathra.AlathranWars.hooks.TownyHook;
@@ -648,7 +648,8 @@ public class CommandUtil {
} }
if (AlathranWars.getInstance().getConfig().getInt("minimumPlayTime") > 0) { if (AlathranWars.getInstance().getConfig().getInt("minimumPlayTime") > 0) {
//check playtime, if its less than min its true //check playtime, if its less than min its true
if (playTicks < (AlathranWars.getInstance().getConfig().getInt("minimumPlayTime") * (60 * 60 * 20))) out = 2; if (playTicks < (AlathranWars.getInstance().getConfig().getInt("minimumPlayTime") * (60 * 60 * 20)))
out = 2;
} }
return out; return out;
@@ -1,10 +1,10 @@
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.war.side.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.War;
import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.conflict.war.WarController;
import com.github.alathra.AlathranWars.conflict.battle.siege.Siege; import com.github.alathra.AlathranWars.conflict.war.side.Side;
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;
import com.github.milkdrinkers.colorparser.ColorParser; import com.github.milkdrinkers.colorparser.ColorParser;
@@ -8,15 +8,20 @@ import java.util.UUID;
public interface Battle { public interface Battle {
void start(); // Initiates battle void start(); // Initiates battle
void stop(); // Ends battle void stop(); // Ends battle
void resume(); // Resume battle after server restart or plugin reload void resume(); // Resume battle after server restart or plugin reload
void attackersWin(BattleVictoryReason reason); // A Attacker victory void attackersWin(BattleVictoryReason reason); // A Attacker victory
void defendersWin(BattleVictoryReason reason); // A Defender victory void defendersWin(BattleVictoryReason reason); // A Defender victory
void equalWin(BattleVictoryReason reason); // A Draw void equalWin(BattleVictoryReason reason); // A Draw
UUID uuid = null; // Battle UUID UUID uuid = null; // Battle UUID
default @NotNull UUID getUUID() { default @NotNull UUID getUUID() {
return uuid; return uuid;
} }
@@ -42,6 +47,7 @@ public interface Battle {
} }
BattleType battleType = null; BattleType battleType = null;
default BattleType getBattleType() { default BattleType getBattleType() {
return battleType; return battleType;
} }
@@ -34,7 +34,10 @@ import org.bukkit.scheduler.BukkitRunnable;
import space.arim.morepaperlib.scheduling.ScheduledTask; import space.arim.morepaperlib.scheduling.ScheduledTask;
import java.time.Duration; import java.time.Duration;
import java.util.*; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
@@ -1,9 +1,9 @@
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.war.side.Side;
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.conflict.war.War;
import com.github.alathra.AlathranWars.conflict.war.side.Side;
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.*;
import com.github.alathra.AlathranWars.events.battle.BattleResultEvent; import com.github.alathra.AlathranWars.events.battle.BattleResultEvent;
@@ -1,9 +1,9 @@
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.war.side.Side;
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.conflict.war.War;
import com.github.alathra.AlathranWars.conflict.war.side.Side;
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;
import com.github.alathra.AlathranWars.enums.battle.*; import com.github.alathra.AlathranWars.enums.battle.*;
@@ -25,7 +25,9 @@ import org.jetbrains.annotations.Nullable;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.util.*; import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -164,6 +166,7 @@ public class Siege implements Battle {
/** /**
* Stop a battle in favor of the attackers * Stop a battle in favor of the attackers
*
* @param reason what triggered the end * @param reason what triggered the end
*/ */
public void attackersWin(BattleVictoryReason reason) { public void attackersWin(BattleVictoryReason reason) {
@@ -191,6 +194,7 @@ public class Siege implements Battle {
/** /**
* Stop a battle in favor of the defenders * Stop a battle in favor of the defenders
*
* @param reason what triggered the end * @param reason what triggered the end
*/ */
public void defendersWin(BattleVictoryReason reason) { public void defendersWin(BattleVictoryReason reason) {
@@ -206,6 +210,7 @@ public class Siege implements Battle {
/** /**
* End a battle in favor of no one * End a battle in favor of no one
*
* @param reason what triggered the end * @param reason what triggered the end
*/ */
public void equalWin(BattleVictoryReason reason) { public void equalWin(BattleVictoryReason reason) {
@@ -3,8 +3,8 @@ 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.battle.beam.CrystalLaser; import com.github.alathra.AlathranWars.conflict.battle.beam.CrystalLaser;
import com.github.alathra.AlathranWars.conflict.battle.beam.Laser; import com.github.alathra.AlathranWars.conflict.battle.beam.Laser;
import com.github.alathra.AlathranWars.enums.battle.BattleSide;
import com.github.alathra.AlathranWars.enums.CaptureProgressDirection; import com.github.alathra.AlathranWars.enums.CaptureProgressDirection;
import com.github.alathra.AlathranWars.enums.battle.BattleSide;
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;
import com.github.milkdrinkers.colorparser.ColorParser; import com.github.milkdrinkers.colorparser.ColorParser;
@@ -1,6 +1,7 @@
package com.github.alathra.AlathranWars.conflict.war; package com.github.alathra.AlathranWars.conflict.war;
import com.github.alathra.AlathranWars.conflict.*; import com.github.alathra.AlathranWars.conflict.Conflict;
import com.github.alathra.AlathranWars.conflict.Occupation;
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.Side;
@@ -1,9 +1,9 @@
package com.github.alathra.AlathranWars.conflict.war; 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.conflict.war.side.Side;
import com.github.alathra.AlathranWars.conflict.war.side.SideCreationException;
import com.github.alathra.AlathranWars.enums.ConflictType; import com.github.alathra.AlathranWars.enums.ConflictType;
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;
@@ -28,7 +28,8 @@ public class WarBuilder {
private Government aggressor; private Government aggressor;
private Government victim; private Government victim;
public WarBuilder() {} public WarBuilder() {
}
public War resume() { public War resume() {
if ( if (
@@ -1,8 +1,8 @@
package com.github.alathra.AlathranWars.conflict.war; 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.conflict.war.side.Side;
import com.github.alathra.AlathranWars.db.DatabaseQueries; import com.github.alathra.AlathranWars.db.DatabaseQueries;
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;
@@ -28,7 +28,8 @@ public class SideBuilder {
private Instant siegeGrace; private Instant siegeGrace;
private Instant raidGrace; private Instant raidGrace;
public SideBuilder() {} public SideBuilder() {
}
public Side rebuild() 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 ||
@@ -130,7 +130,8 @@ public enum DatabaseType {
for (DatabaseType type : DatabaseType.values()) { for (DatabaseType type : DatabaseType.values()) {
if (type.equals(prefix.toLowerCase())) { if (type.equals(prefix.toLowerCase())) {
return type; return type;
}; }
;
} }
return null; return null;
@@ -48,7 +48,8 @@ public final class JooqContext {
} }
@Override @Override
public void release(Connection connection) throws DataAccessException {} public void release(Connection connection) throws DataAccessException {
}
} }
return createWith(new SimpleConnectionProvider(connection)); return createWith(new SimpleConnectionProvider(connection));
} }
@@ -1,7 +1,7 @@
package com.github.alathra.AlathranWars.events.battle; package com.github.alathra.AlathranWars.events.battle;
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.conflict.war.War;
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;
import org.bukkit.event.Event; import org.bukkit.event.Event;
@@ -1,7 +1,7 @@
package com.github.alathra.AlathranWars.events.battle; package com.github.alathra.AlathranWars.events.battle;
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.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,7 +1,7 @@
package com.github.alathra.AlathranWars.events.battle; package com.github.alathra.AlathranWars.events.battle;
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.conflict.war.War;
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;
import com.github.alathra.AlathranWars.enums.battle.BattleVictoryReason; import com.github.alathra.AlathranWars.enums.battle.BattleVictoryReason;
@@ -1,7 +1,7 @@
package com.github.alathra.AlathranWars.events.battle; package com.github.alathra.AlathranWars.events.battle;
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.conflict.war.War;
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;
import org.bukkit.event.Event; import org.bukkit.event.Event;
@@ -1,7 +1,7 @@
package com.github.alathra.AlathranWars.listeners; package com.github.alathra.AlathranWars.listeners;
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.conflict.war.WarController;
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;
import com.github.milkdrinkers.colorparser.ColorParser; import com.github.milkdrinkers.colorparser.ColorParser;
@@ -1,8 +1,8 @@
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.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.conflict.war.WarController;
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;
import com.github.milkdrinkers.colorparser.ColorParser; import com.github.milkdrinkers.colorparser.ColorParser;
@@ -1,7 +1,7 @@
package com.github.alathra.AlathranWars.listeners.siege; package com.github.alathra.AlathranWars.listeners.siege;
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.conflict.war.WarController;
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;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@@ -1,7 +1,7 @@
package com.github.alathra.AlathranWars.listeners.siege; package com.github.alathra.AlathranWars.listeners.siege;
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.conflict.war.WarController;
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;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@@ -1,8 +1,8 @@
package com.github.alathra.AlathranWars.listeners.siege; package com.github.alathra.AlathranWars.listeners.siege;
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.conflict.battle.siege.Siege;
import com.github.alathra.AlathranWars.conflict.war.War;
import com.github.alathra.AlathranWars.conflict.war.side.Side;
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;
import com.github.alathra.AlathranWars.events.battle.BattleResultEvent; import com.github.alathra.AlathranWars.events.battle.BattleResultEvent;
@@ -1,8 +1,8 @@
package com.github.alathra.AlathranWars.listeners.war; package com.github.alathra.AlathranWars.listeners.war;
import com.github.alathra.AlathranWars.conflict.war.side.Side;
import com.github.alathra.AlathranWars.conflict.war.War; import com.github.alathra.AlathranWars.conflict.war.War;
import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.conflict.war.WarController;
import com.github.alathra.AlathranWars.conflict.war.side.Side;
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.war.side.Side;
import com.github.alathra.AlathranWars.conflict.war.War; import com.github.alathra.AlathranWars.conflict.war.War;
import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.conflict.war.WarController;
import com.github.alathra.AlathranWars.conflict.war.side.Side;
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.war.side.Side;
import com.github.alathra.AlathranWars.conflict.war.War; import com.github.alathra.AlathranWars.conflict.war.War;
import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.conflict.war.WarController;
import com.github.alathra.AlathranWars.conflict.war.side.Side;
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.war.side.Side;
import com.github.alathra.AlathranWars.conflict.war.War; import com.github.alathra.AlathranWars.conflict.war.War;
import com.github.alathra.AlathranWars.conflict.war.WarController; import com.github.alathra.AlathranWars.conflict.war.WarController;
import com.github.alathra.AlathranWars.conflict.war.side.Side;
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,7 +1,7 @@
package com.github.alathra.AlathranWars.utility; package com.github.alathra.AlathranWars.utility;
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.conflict.war.WarController;
import com.palmergames.bukkit.towny.object.WorldCoord; import com.palmergames.bukkit.towny.object.WorldCoord;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;