Skip to content

Commit

Permalink
- Fix plot set outpost throwing an error on servers where
Browse files Browse the repository at this point in the history
using_economy is false.
    - Closes #7125.
  • Loading branch information
LlmDl committed Dec 19, 2023
1 parent 1a4fa7b commit 9993975
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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")));
}
}

Expand Down
4 changes: 3 additions & 1 deletion Towny/src/main/resources/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
- 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.

0 comments on commit 9993975

Please sign in to comment.