Skip to content

[UUID DB part 3] Clean up town/nation/resident renaming logic#7963

Merged
LlmDl merged 24 commits intomasterfrom
feat/uuid-db-part-3
Jan 14, 2026
Merged

[UUID DB part 3] Clean up town/nation/resident renaming logic#7963
LlmDl merged 24 commits intomasterfrom
feat/uuid-db-part-3

Conversation

@Warriorrrr
Copy link
Copy Markdown
Member

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.


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

Copy link
Copy Markdown
Member

@LlmDl LlmDl left a comment

Choose a reason for hiding this comment

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

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.

@Warriorrrr Warriorrrr changed the title Clean up town/nation/resident renaming logic [UUID DB part 3] Clean up town/nation/resident renaming logic Sep 29, 2025
Base automatically changed from feat/uuid-db-part-2 to master January 14, 2026 16:27
@LlmDl LlmDl merged commit d17a79c into master Jan 14, 2026
3 checks passed
@Warriorrrr Warriorrrr deleted the feat/uuid-db-part-3 branch January 14, 2026 16:28
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.
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