Solved How do I actually get/use the positions using the wooden axe with the WorldEdit API?

Discussion in 'Plugin Development' started by Auxilium, Feb 1, 2016.

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

    Auxilium

    A short and (to be honest) quite silly question:

    I try to save a new cuboid selection using a new CuboidSelection; however I can't seem to find the part where/how the locations you get when using the wooden axe. These are of course needed for location1 and location2. I've tried to look in the source on the WorldEdit GitHub page, to no avail. Could someone enlighten me?
    Code:
    Player p = (Player) sender;
    CuboidSelection cS = new CuboidSelection(p.getWorld(), location1 , location2)
    getConfig().set("selection", cS);
    saveConfig();
    Thanks in advance!
     
  2. Offline

    teej107

    @Auxilium Save the two locations rather than the CuboidSelection?
     
  3. Offline

    Auxilium

    @teej107 But if I want to define a region, and save that to a config file; won't I need the CuboidSelection method for it then?
     
    Last edited: Feb 1, 2016
  4. Offline

    teej107

    @Auxilium What's "define a region"? Are you using WorldGuard or WorldEdit? WorldEdit selections aren't saved. As long as you have 2 points, that is enough for a Cuboid selection.
     
  5. Offline

    Auxilium

    @teej107 Exactly, that is what I'm trying to accomplish by saving the selection/Cuboid selection to a configuration file, so it should be able to pick up back up once you need that selection again. But for that I need to have both location1 and location2 defined. I've tried using s.getMinimumPoint(), s.getMaximumPoint() (See below) to no avail.

    Code:
    
    // Please mind these are only snippets of the code, should make enough sense hopefully.
    
          Player p = (Player) sender;
    
           s = worldEdit.getSelection(p);
        
          CuboidSelection cS = new CuboidSelection(p.getWorld(), s.getMinimumPoint(), s.getMaximumPoint());
    
          getConfig().addDefault("location:", args[1] + " " + cS);
          saveConfig();

    And yes, I'm using the Worledit API. :)
     
    Last edited: Feb 2, 2016
  6. Offline

    teej107

    @Auxilium Save the two locations rather than the CuboidSelection.
     
  7. Offline

    Auxilium

    @teej107 using .getMinimumPoint() and .getMaximumPoint()?
     
  8. Offline

    teej107

  9. Offline

    Auxilium

Thread Status:
Not open for further replies.

Share This Page