Bug fix and changes #27
Reference in New Issue
Block a user
No description provided.
Delete Branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I just want to run this pull request by you lishid first before it gets merged. I made it so new configs have a different layout and don't use full capitals in the settings. I made it like this because generally YAML config file don't usually have capital letters in the keys so I thought it would be a good idea to make this change to keep with common YAML format standards. But I wanted to make sure you were happy with it before I went ahead and did anything. Let me know if you prefer the old way with capitals and I will happily change it. :)
I'm fine with YAML/config keys either way. Might be worth double checking the bukkitdev page for the instructions if these gets changed.
I'd also say it would be useful if you can run the migration against a previous/old config file and see how well the new file come out, and if there are any inconsistencies.
Other than that, I'm really happy this code is being cleaned up. Now I can feel less ashamed of the code here. :)
Alright, I made those changes.
55deabe56b
Let me know if you see anything I missed out.
Okay I'm just about to test the config updater to make sure it works on old config. Will let you know when done. Shouldn't take long.
Just tested the config updater and it looks good to me.
Old config.yml: http://pastebin.com/Px5fRx3x
New config.yml: http://pastebin.com/uG7hXmdE
Hmm I'd be more curious to test the toggles. That's the more error-prone part I'd say.
With the openinv item I can definitely add some output if the item name provided isn't valid. I definitely agree with that.
As for toggles, what part are you not sure about?
Oh just generally testing that an old config with toggles saved for anychest/silentchest do get migrated correctly. If this goes out to the world and the migration screwed up, the old config toggles are lost forever (unless plugin config backups were a thing)
Yeah I understand what you mean. Whilst on that note, 1 issue that I realized would be a problem for some people is using this plugin with their server in offline mode with the config update/migration. Due to the fact that currently the toggle statuses are saved with lowercased player names, the UUIDFetcher is unable to get the UUID of the player if their username contains uppercased letters because of the fetcher being case sensetive.
As for config backups, that could definitely be possible. We could simply create a backup file of the old config.yml and name it "config_old.yml" so that if anything goes wrong people still have a backup to go back to if need be.
That does sound problematic... I'm thinking of removing the catch in UUIDUtil and make it bubble up the exception. Then you can deal with the failure by not actually saving the config back and disable the plugin with an error message "Your server must be online to migrate the plugin from an old version".
Do you happen to know what bukkit currently does when you ask to get a player by name? Any chance we can use that as a fallback if querying UUIDs is not available?
Yeah I can do something like that with the disabling of the plugin.
As for how Bukkit handles player retrieval by name:
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/CraftServer.java#1243
I guess we could use that as a fallback. Just might not be as accurate but if it's the only option then might be worth it.
Seems like an OK fallback, it looks through both online and offline users. In the case it doesn't find one I think we're ok throwing it out suppose that we can't connect to MC to find the UUID.
Yeah, I think so. I'll do it tonight (within the next few hours) as I have to do some things in real life first. :)
Alright I just pushed another commit. The ConfigUpdater now creates a backup of the old config.yml just in case something goes wrong. Additionally, the UUIDFetcher is now case insensetive. It can now retrieve player UUID's by their name without requiring exact upper/lower casing.
Looking good!
Are you happy with it being merged yet? Or is there anything else you'd like me to add or change? I'm just eager to release it because some people are complaining of it not working and I fixed the problem which was with the UUID fetching.
Oh totally! If you're confident the migration is ready, I'm fine with next steps.
Alright cool well what I plan on doing is running a few more tests today and just making sure everything is working okay as well as some finishing touches and then i'll release it on BukkitDev :)
Cool cool!
Alright just added another commit to this pull request. Did a bit more refactoring as well as added a new searchender command and added more outputting for config conversion.
I'm pretty sure that this pull request is ready to be merged however I'd like it if you could please just go over it to make sure there are no mistakes or I have missed out anything.
With the config migration part, I just want to make sure that you're happy with how it performs the update. As in, backing up the old config and then converting all possible usernames to UUID's and so on so forth.
Other than that I think it's almost good to go.
Looks good to me.
Disregard the last comments I made on here that I deleted. I changed my mind about it and don't think we need to make a whole separate version for 1.7.10 compatibility.
We could release a single version for earlier version compatibility if the work involves minimal changes to the code other than swapping out the craftbukkit jar. Not totally sure that's the case, but either way I wouldn't want to promise maintaining a compatible version in the future.
Wait, 1.7.10 is super old already, right? It's like a year old or something...
Yeah it is very old that's why I changed my mind and now don't think we should do that.
That's fair enough.
Plus the guy who asked for it just commented calling the people on the comments 'assholes' in Russian.