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

Metadata Improvements #4186

Merged
merged 4 commits into from
Jul 23, 2020
Merged

Metadata Improvements #4186

merged 4 commits into from
Jul 23, 2020

Conversation

silverwolfg11
Copy link
Contributor

@silverwolfg11 silverwolfg11 commented Jul 18, 2020

Description:

Previously it was hard to get a specific customdatafield from the metadata which is often what plugins wanted to do. This PR changes the internal set to a map keyed by the customdatafield key and offers new granular methods to fetch metadata.
The customdatafield object was not changed in order to retain legacy compatibility, however I'm like 95% sure this PR will break legacy metadata compatibility because it changes getMetadata() to a collection rather than a set, so oh well.


  • 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.

@silverwolfg11 silverwolfg11 requested a review from a user July 18, 2020 23:02

private HashSet<CustomDataField<?>> metadata = null;
private Map<String, CustomDataField<?>> metadata = null;
Copy link

Choose a reason for hiding this comment

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

Even though when I originally did this I set this to null as the default, I think we're better of making it non-null:

private Map<String, CustomDataField<?>> metadata = new HastMap<>();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reason I kept it null is for lazy-loading. I don't think the majority of TownyObjects will have metadata so I rather not create new objects for all of them if they're not going to be used.

src/com/palmergames/bukkit/towny/object/TownyObject.java Outdated Show resolved Hide resolved
@LlmDl LlmDl merged commit 787245c into master Jul 23, 2020
@LlmDl LlmDl deleted the refactor/metadata branch July 23, 2020 12:21
LlmDl added a commit that referenced this pull request Jul 23, 2020
#4205.
  - Metadata Improvements, courtesy of silverwolfg11 with PR #4186.
  - Do compression via tar and not zip, courtesy of Siris with PR #4195.
    - Tar does a lot better when unicode characters are being used in
the database.
    - You can go back to using zip at your own risk, if that's your
thing.
  - Removed Config Option: plugin.database.flatfile_backup
  - New Config Option: plugin.database.flatfile_backup_type
    - default: tar
    - Valid entries are: tar for tar.gz and zip for zip, use none for no
backup.
  - Allow for nations and towns to set tags less than 4 characters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants