1.16.1 Ore regeneration without resetting world

Discussion in 'Spigot Plugin Development' started by KerchooK, Jun 30, 2020 at 5:27 PM.

  1. This is a follow up to this post.
    tldr: I want to make a way to regen ores without having to reset the whole map.

    I have done quite a bit of work on this concept to minimize resource usage. I have developed the first working snapshot of this plugin, it is not perfect by any means, but is functional. I'm not going to be using this plugin quite yet, I wanted to get some feedback on the functions of my methods and anything I could improve on. I have included the class I use to reset the ores and the config.yml so you can see the features I currently have added. My goal was to make something simple and dynamic. I have added options to cater to every server game type.


    EDIT: As of right now I would't run this with players online, but you could.
    EDIT2: I am not looking to use any version-specific methods (such as NMS) I want to retain compatibility without making a method for every version.
    EDIT3:Fixed the scheduler (I was using the wrong type)
    #1 KerchooK, Jun 30, 2020 at 5:27 PM
    Last edited: Jun 30, 2020 at 5:59 PM
  2. Why create a second thread?

    My tips would be:
    Create a proper constructor for passing important references and instantiating your variables. I think this should simply be provided for good oop.

    Try to avoid long and nested methods by dividing the code into multiple sub methods with more simple but specific tasks to improve code readability.

    Try to find descriptive names for your variables. I think it’s e.g. hard to guess what the purpose of the boolean checkExisting is. If it tells the algorithm if it should check for existing ores somehow I’d name it something like checkExistingOresEnabled because that describes a specific state that can be true or false.
  3. You should see my main class lol