SelectApi 0.2.6

this customizable api permits developers to make selections like worldEdit and use it

  1. snowyCoder
    UPDATE:
    This Api is OUTDATED! and doesn't respect java name convenctions:
    I created this API some years ago and I wasn't really good with java, sorry :/

    this api helps developers to select a 3d space with customizable messages (on left click, on right click and on world error), customizable Item (Stick, axe...) and it saves/loads them even with addicitonal data.

    Code (Text):
    import com.post.snowyCoder.SelectApi.SelectApi;
    create an instance in your class, (you need only one for plugin)
    Code (Text):
    SelectApi selectApi;

        @Override
        public void onEnable() {
            selectApi = new SelectApi("yourPluginName");
        }
    NOTE: all methods return false when an error is encountered.
    when you want the player to select the area write:
    Code (Text):
    selectApi.create("selection name", "player name", Material.usedToSelect, "message on world error", "message on set1", "message on pos2");
    when the player finished selection and wants to confirm it write:
    Code (Text):

    int result = selectApi.confirm("player name");
    if(result == 2)sender.sendMessage("nothing to confirm error");
    else if(result == 3)sender.sendMessage("position not set error");
    if confirm returns 1: no error, 2:nothing to confirm, 3: some or all positions not set!

    if the player dosen't want to create a selection but he typed it write:
    Code (Text):
    if(!selectApi.cancel("player name"))
         sender.sendMessage("nothing to delete error");
    if you wanna remove a selection write:
    Code (Text):
    if(!selectApi.remove("selection name"))
                    sender.sendMessage("select doesn't exist error");
    to get selections write:
    Code (Text):
    List<Selection> tmp = sa.getAllSelections(); //all selections
    Selection sel = selectApi.getSelection("selection name"]) //a selection
    selection provide a method to see if player is inside an area too:
    Code (Text):
    selection.isInside(player)
    to include borders:
    Code (Text):
    selection.isBorderInside(player)
    NOTE:isInside dosen't check for borders, to check with borders write isBorderInside!


    to set selections write:
    Code (Text):
    selectApi.setSelection(selection);
    after you must save!

    selectApi can even store with selection other data (it saves/loads a map<String, String>)
    to do it write:
    Code (Text):
    selection.addictionalData.doWhateverYouWant();
    after remember to save,
    to save you can do in two ways:
    1) save all your plugin's selections
    Code (Text):
    selectApi.save();
    2) save only a selection
    Code (Text):
    selection.save();
    NOTE:if you create manually a selection before you can try isInside you must call selection.order() and before you do that you must select all two the points, if not you'll lose what you've set.

    for who downloades this api: can you review it (even if you put one star) and say me what to add/improve? please i need it.
    and if you find bugs report them, i'll fix as soon as possible.

Recent Updates

  1. debug mistake
  2. Bug fix
  3. isBorderInside added

Recent Reviews

  1. DarkJakeb
    DarkJakeb
    5/5,
    Version: 0.2.6
    GLaDOS would be proud of you. Wheatley not. He couldn't understand it.
  2. maxi1498
    maxi1498
    5/5,
    Version: 0.2.6
    Thanks again for this awesome API and the fast support!
  3. Alexandro
    Alexandro
    5/5,
    Version: 0.2.6
    Very useful!
  4. maxi1498
    maxi1498
    4/5,
    Version: 0.2.2
    Really Good API and i hope it's an mistake! I your last udate there is no path only plugin.yml and Meta-inf folder please correct!
    1. snowyCoder
      Author's Response
      yep mistake, (eclipse sometimes bugs and doesn't select src) fixed
  5. JohnnyKPL
    JohnnyKPL
    5/5,
    Version: 0.2.1
    And off we go!