From 99939756d092d8e9199e34b6a4ff93c166b9c39e Mon Sep 17 00:00:00 2001 From: LlmDl Date: Tue, 19 Dec 2023 09:38:23 -0600 Subject: [PATCH] - Fix plot set outpost throwing an error on servers where using_economy is false. - Closes #7125. --- .../bukkit/towny/command/PlotCommand.java | 13 ++++++++----- Towny/src/main/resources/ChangeLog.txt | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Towny/src/main/java/com/palmergames/bukkit/towny/command/PlotCommand.java b/Towny/src/main/java/com/palmergames/bukkit/towny/command/PlotCommand.java index 117f3eb45a..a67ce9d134 100644 --- a/Towny/src/main/java/com/palmergames/bukkit/towny/command/PlotCommand.java +++ b/Towny/src/main/java/com/palmergames/bukkit/towny/command/PlotCommand.java @@ -645,11 +645,10 @@ public void parsePlotSetOutpost(Player player, Resident resident, TownBlock town TownyWorld townyWorld = townBlock.getWorld(); Coord key = Coord.parseCoord(player.getLocation()); - if (OutpostUtil.OutpostTests(town, resident, townyWorld, key, resident.isAdmin(), true)) { - // Test if they can pay. - if (TownyEconomyHandler.isActive() && !town.getAccount().canPayFromHoldings(TownySettings.getOutpostCost())) - throw new TownyException(Translatable.of("msg_err_cannot_afford_to_set_outpost")); - + // Throws a TownyException with message if outpost should not be set. + OutpostUtil.OutpostTests(town, resident, townyWorld, key, resident.isAdmin(), true); + + if (TownyEconomyHandler.isActive() && TownySettings.getOutpostCost() > 0) { // Create a confirmation for setting outpost. Confirmation.runOnAccept(() -> { // Set the outpost spawn and display feedback. @@ -659,6 +658,10 @@ public void parsePlotSetOutpost(Player player, Resident resident, TownBlock town .setCost(new ConfirmationTransaction(() -> TownySettings.getOutpostCost(), town.getAccount(), "PlotSetOutpost", Translatable.of("msg_err_cannot_afford_to_set_outpost"))) .setTitle(Translatable.of("msg_confirm_purchase", TownyEconomyHandler.getFormattedBalance(TownySettings.getOutpostCost()))) .sendTo(player); + } else { + // Set the outpost spawn and display feedback with no cost confirmation. + town.addOutpostSpawn(player.getLocation()); + TownyMessaging.sendMsg(player, Translatable.of("msg_plot_set_cost", TownyEconomyHandler.getFormattedBalance(TownySettings.getOutpostCost()), Translatable.of("outpost"))); } } diff --git a/Towny/src/main/resources/ChangeLog.txt b/Towny/src/main/resources/ChangeLog.txt index 4ba2b0ba93..013ebaab89 100644 --- a/Towny/src/main/resources/ChangeLog.txt +++ b/Towny/src/main/resources/ChangeLog.txt @@ -9255,4 +9255,6 @@ v0.92.0.11: - Prevent players without plot perms lighting campfires with flame arrows. - Reset bolding/italics/etc and not just colours in formatted names list outputs. - API: add getTownyObjectUUID utility method to TownyEconomyHandler. - - A useful method that an Economy plugin can use in order to get the correct UUID associated with Towny objects' economy accounts. \ No newline at end of file + - A useful method that an Economy plugin can use in order to get the correct UUID associated with Towny objects' economy accounts. + - Fix plot set outpost throwing an error on servers where using_economy is false. + - Closes #7125. \ No newline at end of file