Skip to content

Commit

Permalink
Include the plot price in the /plot fs feedback message (#6062)
Browse files Browse the repository at this point in the history
  • Loading branch information
Warriorrrr authored Aug 3, 2022
1 parent 079c5db commit b9382d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions resources/lang/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ msg_new_mayor: '&b%s is now the mayor!'
msg_new_nation: '&b%s created a new nation called %s'
msg_new_town: '&b%s created a new town called %s'
msg_plot_for_sale: '&b%s put the plot (%s) up for sale!'
msg_plot_for_sale_amount: '&b%s put the plot (%s) up for sale for %s!'
msg_plot_set_type: '&bPlot type set to %s'

msg_cache_block_error: '&cYou have not been registered with Towny. Try relogging.'
Expand Down
12 changes: 9 additions & 3 deletions src/com/palmergames/bukkit/towny/command/PlotCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -1059,10 +1059,16 @@ public void setPlotForSale(Resident resident, WorldCoord worldCoord, double forS
townBlock.setPlotPrice(Math.min(TownySettings.getMaxPlotPrice(), forSale));

if (forSale != -1) {
TownyMessaging.sendPrefixedTownMessage(townBlock.getTownOrNull(), Translatable.of("MSG_PLOT_FOR_SALE", resident.getName(), worldCoord.toString()));
Translatable message = TownyEconomyHandler.isActive()
? Translatable.of("msg_plot_for_sale_amount", resident.getName(), worldCoord.toString(), TownyEconomyHandler.getFormattedBalance(townBlock.getPlotPrice()))
: Translatable.of("msg_plot_for_sale", resident.getName(), worldCoord.toString());

TownyMessaging.sendPrefixedTownMessage(townBlock.getTownOrNull(), message);

if (!resident.hasTown() || (resident.hasTown() && townBlock.getTownOrNull() != resident.getTownOrNull()))
TownyMessaging.sendMsg(resident, Translatable.of("MSG_PLOT_FOR_SALE", resident.getName(), worldCoord.toString()));
Bukkit.getPluginManager().callEvent(new PlotSetForSaleEvent(resident, forSale, townBlock));
TownyMessaging.sendMsg(resident, message);

Bukkit.getPluginManager().callEvent(new PlotSetForSaleEvent(resident, townBlock.getPlotPrice(), townBlock));
} else {
TownyMessaging.sendMsg(resident, Translatable.of("msg_plot_set_to_nfs"));
Bukkit.getPluginManager().callEvent(new PlotNotForSaleEvent(resident, townBlock));
Expand Down

0 comments on commit b9382d4

Please sign in to comment.