Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Towny more resiliant to errors which come from having no Economy present on the server. #7127

Merged
merged 2 commits into from
Dec 21, 2023

Conversation

LlmDl
Copy link
Member

@LlmDl LlmDl commented Dec 19, 2023

Description:

Alter ConfirmationTransaction to no longer take in an Account in the constructor, instead it takes in a TownyObject, which will resolve an account. This prevents errors when non-Economy-enabled servers attempt to create a Confirmation with a cost set on it.

Make TownyEconomyHandler#getFormattedBalance able to handle returning a formatted balance when the Economy is not active.

Add prettyMoney method to BaseCommand, use it throughout the command classes to make things look cleaner.


New Nodes/Commands/ConfigOptions:


Relevant Towny Issue ticket:


  • I have tested this pull request for defects on a server.

By making this pull request, I represent that I have the right to waive copyright and related rights to my contribution, and agree that all copyright and related rights in my contributions are waived, and I acknowledge that the TownyAdvanced organization has the copyright to use and modify my contribution under the Towny License for perpetuity.

present on the server.

Alter ConfirmationTransaction to no longer take in an Account in the
constructor, instead it takes in a TownyObject, which will resolve an
account. This prevents errors when non-Economy-enabled servers attempt
to create a Confirmation with a cost set on it.

Make TownyEconomyHandler#getFormattedBalance able to handle returning a
formatted balance when the Economy is not active.

Add prettyMoney method to BaseCommand, use it throughout the command
classes to make things look cleaner.
* @param loggedMessage The message logged in the money.csv file.
* @param insufficientFundsMessage Transatable which will display the cannot pay message.
*/
public ConfirmationTransaction(Supplier<Double> costSupplier, Account payee, String loggedMessage, Translatable insufficientFundsMessage) {
public ConfirmationTransaction(Supplier<Double> costSupplier, TownyObject townyObject, String loggedMessage, Translatable insufficientFundsMessage) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can just accept an EconomyHandler instance which resident/town/nation all implement

@LlmDl LlmDl merged commit 6773c7c into master Dec 21, 2023
4 checks passed
@LlmDl LlmDl deleted the fix/no_eco_resiliancy branch December 21, 2023 23:33
@LlmDl LlmDl added this to the 0.100.1.0 milestone Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants