ExploreRegion: Fix encoding X and Z #1357
Merged
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.
Use a long to store the two ints (x is upper and z is lower) - this is guaranteed to work with any world map size out there.
It also properly handle negative values that the old implementation sometimes did not properly manage.
This might use slightly more RAM, but should provide support for actual infinite/huge map sizes
Context
Negative coordinates in both X and Z do not encode properly back and forth between
getPlace()
andgetChunkX()
+getChunkZ()
Steps to reproduce
it only bugs out if I do a
/stop
- and it's extremely reproducible on my server.Doing
/jobs reload
and other commands do not affect it, it seems to be a storage/read back on start-up issue.As seen from my debugging branch the X/Z values do not always encode back and forth correctly, causing bad data (and duplicated rows) in the DB
the X and Z coords matches F3 in-game, but the reversing does not 🙂
but its true for both x and z values, once the player are in negative territory, they skew
SQLite output (same issue with MySQL)
Version info
Plugins
Plugins (48): AdvancedAFK, ArmoredElytra, AuctionHouse, BungeeTabListPlus, ChestShop, ChestShopNotifier, ChestSort, CMILib, CoreProtect, DiscordSRV, DiscordSRV-Staff-Chat, dynmap, Essentials, FastChunkPregenerator, floodgate, Graves, HolographicDisplays, HoloPlots, InvSeePlusPlus, Jobs, Lands, LeaderHeadsRevamped, LevelledMobs, LuckPerms, MoreMobHeads, Multiverse-Core, Multiverse-Inventories, Multiverse-Portals, MyCommand, NetworkManager, PlaceholderAPI, PlaceholderSIGN, Plot2Dynmap, PlotSquared, ProtocolLib, ServerlistMOTD*, ShowItem, SimplePortals, spark, SurvivalInvisiframes, UnifiedMetrics, Vault, VentureChat, ViaBackwards, ViaVersion, Votifier, VotingPlugin, WorldEdit
Signed-off-by: Christian Winther [email protected]