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

Handle empty towns during duplicate resident removal #7474

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

Warriorrrr
Copy link
Member

Description:


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.

@Warriorrrr Warriorrrr added the bug label Jun 18, 2024
@Warriorrrr Warriorrrr added this to the 0.100.4.0 milestone Jun 18, 2024
Comment on lines +475 to +478
try {
universe.unregisterTown(olderResTown);
} catch (NotRegisteredException ignored) {}
deleteTown(olderResTown);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
try {
universe.unregisterTown(olderResTown);
} catch (NotRegisteredException ignored) {}
deleteTown(olderResTown);
TownyUniverse.getInstance().getDataSource().removeTown(town, DeleteTownEvent.Cause.NO_RESIDENTS, null, false);

Copy link
Member

@LlmDl LlmDl Jun 18, 2024

Choose a reason for hiding this comment

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

Alternatively we could just call resident.removeTown() and this would be taken care of I think.

I see the comment saying we cannot use resident.removeTown()...

Copy link
Member Author

Choose a reason for hiding this comment

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

The town & townblocks are not loaded yet at this point so I figured we could get away with unregistering it and deleting the file

Copy link
Member

Choose a reason for hiding this comment

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

touché

@LlmDl LlmDl merged commit 770ad6c into master Jun 19, 2024
4 checks passed
@LlmDl LlmDl deleted the fix/duplicate-res-removal-empty-town branch June 19, 2024 18:02
LlmDl added a commit that referenced this pull request Jun 19, 2024
galacticwarrior9 with PR #7478.
  - Handle empty towns during duplicate resident removal, courtesy of
Warrior with PR #7474.
  - Add plot group creation/deletion events #7476, courtesy of Warrior
with PR.
    - Closes #7475.
  - Bump org.apache.maven.plugins:maven-surefire-plugin from 3.2.5 to
3.3.0.
  - Drop support for MC 1.16-1.18, update the readme.
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