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

Branch will remove TownBlockLists saving/loading, remove TownBlocks from TownyWorld, add TownBlocks to Town and TownyUniverse. #3838

Merged
merged 15 commits into from
Apr 2, 2020

Conversation

LlmDl
Copy link
Member

@LlmDl LlmDl commented Mar 28, 2020

Description:

This Branch will accomplish a number of things, most importantly:

  • Stop saving and loading townblocklists (towny\data\townblocks.txt
    • Townblocks are loaded from the towny\data\townblocks folder directly and stored in their Towns primarily, with a seconday map being held in TownyUniverse as a fallback.
  • Remove townblocks from the TownyWorlds, where they were in far to large a group to reasonably save them.
  • Hopefully solve the issue of disappearing townblocks.

New Nodes/Commands/ConfigOptions:

None.


Relevant Towny Issue ticket:

All of the tickets in the Disappearing Townblocks project.
#3783 #3796 #3813 #3821 #3844


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

TownyAPI.getInstance().getTownBlock(location).
Towny parses the entire towny\data\townblocks\ folder to create a
ConcurrentHashMap in TownyUniverse (probably just temporary for now.)

Towny then loads individual TownBlocks from that list, and stores them
in the towns.

Saving the townblocklist is now done on a per-town basis, only doing the
full batch on saveAll().
Continuing on with removing TownBlockLists, ending TownBlocks being
tracked per-TownyWorld, adding TownBlocks being tracked per-Town.

- Add TownyAPI.isWilderness(WorldCoord worldCoord) method.
- Flesh out methods in TownyUniverse for maintaining the global
townblocks hashmap.
- Remove all traces of saveTownBlockList() and saveTownBlockList(Town
town).
- Remove extra townblock removal methods from TownyDatabaseHandler
(removeOneOfManyTownBlocks(), removeManyTownBlocks())
- Remove deprecated methods used to update ancient Towny databases that
still stored TownBlocks in the town and resident files.
  - (utilLoadTownBlocks(), utilLoadTownBlockTypeData(),
utilSaveTownBlocks()
- Replaced the Town's List<TownBlock> with ConcurrentHashMap<WorldCoord,
TownBlock>.
- Removed TownyWorld's ConcurrentHashMap<Coord, TownBlock> townBlocks,
with all methods forwarding to TownyUniverse or otherwise handling
things.
database/townblocks_update

Conflicts:
	src/com/palmergames/bukkit/towny/command/TownCommand.java
	src/com/palmergames/bukkit/towny/db/TownyFlatFileSource.java
	src/com/palmergames/bukkit/towny/object/TownyWorld.java
- Removed Town and TownyUniverse newTownBlock() methods.
- Added addTownBlock() to TownyUniverse for populating the TownyUniverse
townBlocks ConcurrentHashMap.
- Added townBlocks CHM to TownyUniverse.clearAll() to fix /ta reload.
- Alter TownCommand.newTown() to reflect change to making new
TownBlocks, sorted out needless setting of the homeblock.
- Call TownyUniverse.removeTownBlock() directly from
DataSource.removeTownBlock(), to begin removal of TownBlocks from towns
and then the database.
- Alter Flatfile & SQLSource loadTownBlockList(), we now create a new
TownBlock object with a null town and then add it to the TownyUniverse
townBlock CHM.
  - Town is taken care of later on in the loading process when each
TownBlock is loaded.
- Bit of reodering in the Town object for manipulating the Town
townBlock CHM.
- TownClaimTask has had it's townClaim slightly simplified.
- Minor changes to things, mainly moving more TownBlock lookup calls
from pointing to TownyWorld, via the API/TownyUniverse.
@LlmDl LlmDl self-assigned this Mar 28, 2020
- On deletion of a townblock file, try to move it to
towny\data\townblocks\worldname\deleted\townname\
  - Should make it easier to recover town's townblocks if something does
go wrong.
@LlmDl LlmDl merged commit a7a6599 into master Apr 2, 2020
@LlmDl LlmDl deleted the database/townblocks_update branch April 5, 2020 00:22
@LlmDl LlmDl added this to the 0.96.2.0 milestone Apr 11, 2020
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