WorldEdit selections

Discussion in 'Plugin Development' started by Hex_27, Apr 29, 2015.

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

    Hex_27

    I want to get all the Chunks in a worldedit selection. How can I do this?
     
  2. Offline

    caderape

    @Hex_27 get the selection, loops all the location in the selection
    Create an arraylist for store the chunk, and for each location check if the chunk is in the arraylist, then add it
     
  3. Offline

    teej107

    @Hex_27 loop through the every 16th block in the selection and put the chunk in a collection
     
  4. Offline

    Hex_27

    @caderape the problem is, I'm checking this every time a player moves to a different chunk. Would this lag?
    @teej107 Maybe would lag a little less but my question would still be the same
     
  5. Offline

    caderape

    @Hex_27 Yea, it's a problem.
    You may store the chunk when you load the plugin, anbd check if the claim is in the list when a player move. Would be better.

    e.getfrom().getlocation().getblock().getlocation != e.getto().getlocation().getblock().getlocation();
    You may add this on your event. You code will be called every block, and not 10 times by block.
     
  6. @Hex_27 Why on earth would you need to get all chunks in a WorldEditSelection every time a player changes chunks? Why don't you tell us what you're actually doing and maybe we can find a better way to do that :)

    @caderape Also, he wants to run it every time the player changes chunk apparently, not every time he changes block, so that method could be made more efficient.
     
  7. Offline

    Hex_27

    @AdamQpzm its for a selection function for something like factions. For what my plugin is designed, I set the "Kingdom" tag from a chunk, so I'm assuming it would require getting all chunks.
     
  8. @Hex_27 I'm not sure I understand, can you provide some code to show what you mean?
     
  9. Offline

    teej107

    Get the first point and the second point. Loop between the points and increment every 16 blocks along the x/z. Every iteration, get the chunk of that location and do whatever you need to do with it.
     
Thread Status:
Not open for further replies.

Share This Page