[UUID DB part 3] Clean up town/nation/resident renaming logic#7963
Merged
[UUID DB part 3] Clean up town/nation/resident renaming logic#7963
Conversation
LlmDl
requested changes
Sep 25, 2025
Member
LlmDl
left a comment
There was a problem hiding this comment.
I made a few comments pointing out deprecations that didn't have a "since version X" in their comments, but there are more. Please add a "@deprecated since 0.101.2.*" to each of the newly deprecated methods.
Towny/src/main/java/com/palmergames/bukkit/towny/db/TownyDataSource.java
Show resolved
Hide resolved
Towny/src/main/java/com/palmergames/bukkit/towny/object/Nation.java
Outdated
Show resolved
Hide resolved
LlmDl
added a commit
that referenced
this pull request
Jan 14, 2026
- UUID Database Update!
- READ CAREFULLY, THIS UPDATE HAS CHANGES THAT CANNOT BE REVERSED
EASILY.
- Since Minecraft added UUIDs to players there has always been the
idea of changing Towny over to using UUIDs as the main key in our
database,
but due to database instability this was not something that was
considered a smart change. Database stability was majorly improved years
ago
however and starting in 2022 and 2023 I (LlmDl,) had pull requests
on deck exploring/planning what a UUID-based database would look like
for
Towny. In the middle-to-late 2025 Warrior decided to revive the
UUID database concept, breaking things into bite-sized pull requests
that
made the concept easier to review and merge. Those pull requests
are as follows:
- Load UUIDs for residents, towns & nations early, courtesy of
Warrior with PR #7945.
- Replace references to names with UUIDs in the database, courtesy
of Warrior with PR #7962.
- Clean up town/nation/resident renaming logic, courtesy of
Warrior with PR #7963.
- Use UUIDs for town/nation/resident file names in flatfile,
courtesy of Warrior with PR #8023.
Thanks to Warrior's efforts the UUID database has become a
reality!
- What this means for Towny server admins:
- The database no longer saves using resident, town and nation
names. Instead you will see UUID-named .txt files in the resident, town
and
nation folders, and UUIDs in the lists of friends, enemies and
allies.
- Once you updated to this version your database will be converted
and there is no going back. Towny will create backups of your pre-UUID
database if you have backups enabled in the Towny config.yml and
you are using Towny in flatfile!
- If your Towny database is stored in MYSQL you need to make your
own backup! Towny doesn't back up MYSQL databases!
- Benefits:
- Your Towny database just got more error-proof.
- Renaming of residents, towns, nations should no longer be prone
to edge-case scenarios that could cause issues.
- Server hosts which don't allow some unicode characters in the
server file system's filenames will no longer fail to save/load towns
and
nations with special (usually accented,) characters.
- If you change hosts and your future-host does not allow the
above unicode characters to be used in the filesystem, your server will
not
immediately fail to load!
- The main issue with Towny databases over the last few years was
typically towns/nations being named with characters that server hosting
would not allow in the filesystem, this database update will
make this issue non-existant, which is why the benefits of this update
outweigh the cons.
- Cons:
- The database's residents/towns/nations are no longer saved with
their names. This makes editing your database manually trickier.
- To help this out the residents' files will now contain their
town's last-known name, the towns' files will contain their nation's and
mayor's last-known name. All residents, towns and nations
files will contain their last-known name in their files.
- Ultimately, the benefits have outweighed the cons, stability has
been good for Towny databases for 5+ years, and it is time to make this
change in order to reduce the complexity of the codebase and to
improve how Towny runs on varied server hosts.
This file contains hidden or 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
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:
Enforces that towns/nations/residents have non null UUIDs and prevents them from being changed later, in order to have reliable hashCode and equals methods.
That in turn allows us to remove all of the complicated renaming while still having everything just work.
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.