Solved Use WorldEdit API to //regen an area.

Discussion in 'Plugin Development' started by woutwoot, Nov 30, 2014.

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

    woutwoot

    Simple question. I have WorldEdit as a library. I have 2 Location objects selecting a cuboid region. How would I get the WorldEdit plugin to //regen that area?
     
  2. Offline

    woutwoot

  3. woutwoot That's the thing you get used to when working against an API, you work out if you actually need what they're using, and how to get those things if you do need them. I could give you a solution, of course, but it's much better you get some experience with this sort of thing, as it'll be rare that you find someone has exactly what you need when doing this sort of thing :)

    My hint would be to follow the code - what does it do with the player and the editsession? Is there any way you can cut that bit out? If not, can you get those things some how?
     
  4. Offline

    woutwoot

    This is what I've tried, but does not work:
    Code:java
    1. public void regenerate(){
    2. Selection selection = new CuboidSelection(this.getC1().getWorld(),this.getC1(), this.getC2());
    3. try {
    4. Region region = selection.getRegionSelector().getRegion();
    5. region.getWorld().regenerate(region, WorldEdit.getInstance().getEditSessionFactory().getEditSession(region.getWorld(), -1));
    6. } catch (IncompleteRegionException e) {
    7. }
    8. }
     
  5. woutwoot Have you looked at BukkitWorld.java? It seems like it has a nice callable method :p
     
  6. Offline

    woutwoot

    Nevermind, my method does work :D I'm just stupid and didn't actually use it the first time I tested :) Thanks for the help!
     
    AdamQpzm likes this.
Thread Status:
Not open for further replies.

Share This Page