-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
Add OfflinePlayer and UUID support to Economy backend #7425
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
Label-Money
Label-Resident
Label-Command
Label-TownyAdmin
labels
May 18, 2024
This was referenced May 18, 2024
Closed
Warriorrrr
force-pushed
the
feat/vault-uuid-redux
branch
from
July 27, 2024 15:36
bad28c3
to
d816404
Compare
Warriorrrr
force-pushed
the
feat/vault-uuid-redux
branch
from
July 27, 2024 15:39
d816404
to
be898fe
Compare
LlmDl
requested changes
Oct 22, 2024
Towny/src/main/java/com/palmergames/bukkit/config/ConfigNodes.java
Outdated
Show resolved
Hide resolved
LlmDl
changed the title
Economy UUID support
Economy backend gains OfflinePlayer and UUID support
Oct 23, 2024
pattern. Made depositall use the economyexecutor too.
Takes town, nation, resident, and serveraccount as subcommands, and outputs the name, UUID, and balance of the EconomyHandler's Account. Fixes an issue with array index out of bounds when /ta eco was run without a sub command. Adds a HelpMenu for /ta eco and /ta eco info.
Warriorrrr
force-pushed
the
feat/vault-uuid-redux
branch
from
October 23, 2024 14:43
0bedfb4
to
949cf01
Compare
LlmDl
changed the title
Economy backend gains OfflinePlayer and UUID support
Add OfflinePlayer and UUID support to Economy backend
Oct 23, 2024
LlmDl
added a commit
that referenced
this pull request
Oct 23, 2024
- Add OfflinePlayer and UUID support to Economy backend, courtesy of Warrior with PR #7425. - Adds a "modern" economy implementation for Vault and Reserve back ends, while maintaining "legacy" implementations. - Already established servers will have their server set to legacy, while new installs will begin using the modern system right away. - The modern implementation makes use of Vault's OfflinePlayer methods, making Towny better suited to newer economy plugins that might not have fully implemented VaultAPI in their code. - Towny's Account class has been revamped with the Towny objects' UUIDs being used. - In cases where a server is using EssentialsX Economy, Towny will convert our non-player accounts' UUIDs into V2 UUIDs, allowing EssEco to know they do not belong to players. - Changed command: /ta depositall has changed to /ta eco depositall - Changed command: /ta resetbanks has changed to /ta eco resetbanks - New Command: /ta eco info [TownyObject] {name} - Used to see information about a resident, town, nation, or the Towny serveraccount's economy Account. - New Command: /ta eco convert modern - Will convert your Towny legacy accounts into modern accounts in your Economy plugin. - New Command: /ta eco convert {economyplugin} - Will convert your Towny economy accounts from your existing economy plugin, into the given economy plugin. - New Permission Node: towny.command.townyadmin.eco.* - A child node of towny.command.townyadmin.*, no changes required in your permission plugin. - Child Nodes: - towny.command.townyadmin.eco.depositall - towny.command.townyadmin.eco.resetbanks - towny.command.townyadmin.eco.info - towny.command.townyadmin.eco.convert - New Config Option: economy.advanced.modern - Default: true (on existing installs this will default to false) - When enabled, Towny will use UUIDs when communicating with your economy plugin. - Most users will never have to touch this, but for existing servers this option will automatically be set to false. - If this option is disabled and you wish to avoid losing data, use the `/townyadmin eco convert modern` command to convert. - New Config Option: economy.advanced.npc_uuid_version - Default: -1 - The UUID version to use for non-player accounts. This is used so that economy plugins can more easily differentiate between player and NPC accounts. - The default is -1, which disables modifying npc uuids.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Refactors our economy code to pass both the town name & uuid to economy plugins for greater compatibility.
Using some reflection a proper OfflinePlayer is made for each bank account, a v2 uuid is used for non player accounts while select economy implementations are in use to indicate that these should be treated as NPC accounts, but most economy implementations will be sent a v4 uuid.
To avoid breaking stuff on existing servers, the economy provider is put into "legacy" mode using a config migration when upgrading. This will make the plugin continue using the name based methods for vault/reserve. Server admins can use the new
/ta eco convert modern
command to migrate all balances to the modern provider (recommended to not have any players on the server to avoid transactions during the split second of converting being undone). After conversion, the server will use the "new" methods from then on out.New servers will automatically use the name & uuid methods, but they can choose to disable the option if they want.
Economy plugins that use the worldName variable will also be a bit more happier with Towny, previously the world that the player is in when the account is created would keep getting passed to vault, and it would not update when switching dimensions. This is now fixed, and the player's world (or first world on the server when offline) is now passed to it.
New Nodes/Commands/ConfigOptions:
Adds a new economy subcommand for the townyadmin command
Relevant Towny Issue ticket:
Supersedes #4702
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.