Solved Factions Claiming Regions

Discussion in 'Plugin Development' started by Chr0mosom3, Mar 4, 2019.

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

    Chr0mosom3

    Hey there, I am currently working on creating a custom factions plugin, unlike other threads, this one is going to be quite different. I have the whole factions plugin planned out on paper and I know exactly how I am going to do it, but I also don't. One big problem that I have found is claiming. I have thought of having a system where you do /f claim and it gives you a shovel to claim but that wouldn't work if you would have multiple claims for example, and how to save it in the config is another story. Can anyone tell me how I would go about this? I honestly have no ideas what so ever. I was thinking about chunks but then /f map would be very complicated. Any help would be greatly appreciated.
     
  2. Offline

    timtower Administrator Administrator Moderator

    @MrDaniel What kind of area's do you want to claim? Chunk would be the easiest method to be honest, then you don't need to manual create the regions anymore.
     
  3. Offline

    Chr0mosom3

    @timtower, how would I go around that, do I just loop over all the chucks in the world and add them to a hashmap with who claimed it and save it like that in the config? If your answer is yes how would I get the chunks?
     
  4. Offline

    timtower Administrator Administrator Moderator

    @MrDaniel They claim it while they are in the chunk, no need to loop over it.
     
  5. Offline

    Chr0mosom3

    @timtower, how would I go about saving the claims in a config?
     
  6. Offline

    timtower Administrator Administrator Moderator

    Chunk has a chunkX and chunkY, if you save those in a list that represents all chunks owned by a specific faction then you have everything you need.
     
    Chr0mosom3 likes this.
  7. Offline

    Chr0mosom3

    I would have never thought of that, xD. Another questions (yes, questions) (sorry for asking so many questions)

    1.) How would I go by preventing the player claiming a chunk
    2.) If I want to create a map of the area how would I do that? (for example /f map)
     
  8. Offline

    timtower Administrator Administrator Moderator

    @MrDaniel This place is made to aak questions, so don't stop till you got all your answers!
    1. Permissions, Player#hasPermission("f.claim")
    2. Lets get the system working first;)
     
    Chr0mosom3 likes this.
  9. Offline

    Chr0mosom3

    @timtower, I should have figured out number 1 myself xD (out of curiosity, why do people use # instead of .)


    Is the system working? Well, thanks to you it has a higher chance of working out. I had a couple ideas for number 2, one of them being a for loop and storing chunks in a multi dimensional array but I don't really think that's efficient and the way of doing this. Do you know a better way or am I on my own?
     
  10. Offline

    CraftCreeper6

    @MrDaniel
    Using # is so that people can't just copy and paste the code, also to prevent it becoming a link to nowhere.

    If you wanted to create a map you'd get all chunks in an x by y area and check against the hashmap chunks if they are claimed. If they are, then you could show some kind of indication that they are, and if they aren't claimed, just ignore them.
     
  11. Offline

    Chr0mosom3

    CraftCreeper6 likes this.
Thread Status:
Not open for further replies.

Share This Page