Know if a buried treasure has been opened

Discussion in 'Spigot Plugin Development' started by Oka123, Jul 14, 2019 at 11:38 AM.

  1. Hi,

    I would like to improve the buried treasure feature but for that I need to create explorer map of buried treasure which hasn't been explored yet.

    I had the idea to use locateStructure method and test if the chunk has been generated with the isChunkGenerated method but It will not find a buried treasure which hasn't been opened in an already generated chunk

    So I need to find a method to test the chest itself, any idea ?

    Thank
     
  2. The createExplorerMap method has a parameter for this
    createExplorerMap(@NotNull
    World world,
    @NotNull
    Location location,
    @NotNull
    StructureType structureType,
    int radius,
    boolean findUnexplored)
    "findUnexplored - whether to find unexplored structures"
     
  3. Yes, but it would not find ONLY unexplored it will find unexplored, and explored the way I understand it
     
  4. Well what you could do is use World#locateNearestStructure and then parsing the given Location to World#createExplorerMap.
     
  5. I dont think so. Because when looking at the source code, this method uses the locateNearestStructure method. and in that method it states:
    "findUnexplored - true to only find unexplored structures"
    and also
    "This can also lead to instances where the server can hang if you are only looking for unexplored structures. This is because it will keep looking further and further out in order to find the structure."

    That being said, from what I can see, if you set the boolean to true, it will only look for unexplored structures, therefor creating the map with that boolean true, it will only create a map for unexplored structures