Get the worldedit selection?

Discussion in 'Plugin Development' started by bittiez, May 12, 2012.

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

    bittiez

    I'm sorry of this is the wrong place for this question, but how would I get the current worldedit selection from within my plugin?

    Or how to get a cube from 2 points(I'm having a lot of trouble finding any help on either of these, I've been searching all morning, the worldedit would be much easier for me, but I could do with a way to get a cube from 2 points)
     
  2. Offline

    Double0negative

    Code:
    WorldEditPlugin we = p.getWorldEdit();
            Selection sel = we.getSelection(player);
            if(sel == null){
                player.sendMessage(ChatColor.RED+"You must make a WorldEdit Selection first");
                return;
            }
            Location max = sel.getMaximumPoint();
            Location min = sel.getMinimumPoint();
    
     
  3. Offline

    bittiez

    Okay this has given me a HUGE start, thank you, however I'm not sure how to fix this error properly: p can't be resolved..
    Its quickfix is adding this line: WorldEditPlugin p;
    However that makes the getSelection(player);
    become an error which gives me the quick fix of changing we
    to a WorldEdit instead of WorldEditPlugin.. which then makes the getSelection(player);
    undefined for the type WorldEdit.. :) I'm lost



    Second, (sorry for all the questions I promise I'm searching everything before I ask here)
    How would I go about getting all the blocks in that selection
     
  4. Offline

    SourceForums

    I am currently stuck on this problem too. I know for a fact that 'p' is the variable for the player though.
     
  5. Offline

    john01dav

    Code:
    for(Plugin plugin : pm.getPlugins()){
                if(plugin instanceof WorldEditPlugin){
                    p = ((WorldEditPlugin) plugin);
                    break;
                }
            }
     
Thread Status:
Not open for further replies.

Share This Page