From 31d0bb1f6baf2aa6767bd1e47cd32bf72313699e Mon Sep 17 00:00:00 2001 From: darksaid98 Date: Tue, 1 Aug 2023 17:27:32 +0200 Subject: [PATCH] fix: siege start admin override --- .../alathra/AlathranWars/commands/SiegeCommands.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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 d50cdac..f73ec98 100644 --- a/src/main/java/com/github/alathra/AlathranWars/commands/SiegeCommands.java +++ b/src/main/java/com/github/alathra/AlathranWars/commands/SiegeCommands.java @@ -71,7 +71,7 @@ public class SiegeCommands { .setOptional(true) .withPermission("AlathranWars.admin")*/ ) - .executesPlayer((Player p, CommandArguments args) -> siegeStart(p, args, false)); + .executesPlayer((Player p, CommandArguments args) -> siegeStart(p, args, asAdmin)); } public static CommandAPICommand commandStop(boolean asAdmin) { @@ -145,16 +145,15 @@ public class SiegeCommands { if (!location.getWorld().equals(townLocation.getWorld())) throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("You need to be in the same world as the town you're attacking!").build()); - if (location.distance(townLocation) >= Siege.BATTLEFIELD_START_MAX_RANGE) + if (location.distance(townLocation) >= Siege.BATTLEFIELD_START_MAX_RANGE && !asAdmin) throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("You need to be within blocks of the town to start a siege!").parseMinimessagePlaceholder("range", String.valueOf(Siege.BATTLEFIELD_START_MAX_RANGE)).build()); - if (location.distance(townLocation) <= Siege.BATTLEFIELD_START_MIN_RANGE) + if (location.distance(townLocation) <= Siege.BATTLEFIELD_START_MIN_RANGE && !asAdmin) throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("You need to be further than blocks away from the town to start a siege!").parseMinimessagePlaceholder("range", String.valueOf(Siege.BATTLEFIELD_START_MIN_RANGE)).build()); - if ((Main.econ.getBalance(siegeLeader) < Siege.SIEGE_VICTORY_MONEY)) + if ((Main.econ.getBalance(siegeLeader) < Siege.SIEGE_VICTORY_MONEY) && !asAdmin) throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("You need to have $ to start a siege!").parseMinimessagePlaceholder("amount", String.valueOf(Siege.SIEGE_VICTORY_MONEY)).build()); - side.setSiegeGrace(); Siege siege = new Siege(war, town, siegeLeader);