Region protection help

Discussion in 'Plugin Development' started by AstramG, May 26, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    AstramG

    Hello, I'm trying to make a region protection plugin like some of the others like Towny and Faction. However, mine will be different. Anyways, I'm just having some trouble with actually creating and saving the region, then checking if a location is in the region. I know it seems like a lot but I'm just kind of confused, anyways thank you and I hope someone can help!
     
  2. Offline

    Jamesthatguy

    On a new region creation put the coords in a yml under the title of the defined region. I am not sure of the best way to check the location of the region. The only way I can think of is having a ton of if statements in events such as BlockBreak etc. but I am not sure.
     
  3. Offline

    catageek

    Best way to achieve this is to store data in a quadtree. Checking if a location is in a region is just checking that the region is referenced in the leaf where the location points to. It is the faster algorithm.

    To make your quadtree persistent you must also store your regions in a Map and only save the map. so you have 2 storage to synchronize when adding or removing the region: the quadtree and the map. When loading the plugin, you build the quadtree from the saved map.

    You may want to check a plugin that do exactly this: BCProtect.
     
  4. Offline

    AstramG

    Any easier ways to do this?
     
Thread Status:
Not open for further replies.

Share This Page