falkirks / MineReset

Powerful mine resetting tool
MIT License
43 stars 42 forks source link

Fix to mines not resetting from PC-imported worlds #129

Open ExileWeb opened 4 years ago

ExileWeb commented 4 years ago

Fix for the reset task failing for PC imported worlds, as the world name isn't correct

falkirks commented 3 years ago

Thanks for making this PR. I don't have the ability to test PRs at this point so I have been holding off merging. I think PC users can just rename the folder, right?

ExileWeb commented 3 years ago

Yeah if they change the config value for the mine name to the folder name then it works too.

ExileWeb commented 3 years ago

I'd like to resolve this PR/issue as I'm still seeing people having trouble due to this.

After testing I'll propose a more robust PR which explicitly checks on mine creation if the Level getName method matches the Level getFolderName method. The few lines of code added won't affect performance, but I'm sure my previous one line change would be sufficient.

If the two functions don't match then it's definitely not a Pocketmine-created level, hence must be imported from a different level format (PC) or different LevelDB version; in this case the Level getFolderName method returns the correct level name value to store in the config file for use in further calls.

If you don't want to change the plugin till PM-4 then close this PR.