inv.getLocation() error

Discussion in 'Spigot Plugin Development' started by 24763, May 19, 2016.

Thread Status:
Not open for further replies.
  1. Hey Spigot,
    So in my NameMyTool plugin i wanted to support both 1.8 and 1.9 so both jars are added to the build path, i wanted to grab the inventory location and if its null (which i want) to do the rest of my code.

    When using inv.getLocation() i get:
    Code (Text):
    Caused by: java.lang.NoSuchMethodError: org.bukkit.inventory.Inventory.getLocation()Lorg/bukkit/Location;
    My imports are not directly specifying a version and was confused why i am still getting this error,
  2. Whichever jar has priority in your build path is missing the method.
  3. I see, after changing i see 1.8 does not have a inv.getLocation() method, any other possible way of checking its location?
  4. Why? Just use the 1.9 version. It should implements the 1.8 methods and the newest. So you had to import one api. :)
  5. Inventory getLocation?? this no exist..
  6. Make boolean methor for return "nulls"
  7. My plugin is meant to support both 1.8 and 1.9, when using this method on a 1.8 server i get the error i said above thats why :p
  8. If you remove the 1.9 api? :)
  9. Make a version string,with split etc.."
    After make a simple method with equals example:
    if (version.equals("1.8.8"))) {
    Your code
    }else if (version.equals("1.9") {
  10. I need both 1.8 and 1.9 APIs for various things :p
  11. I already have a similar system but thank you :)
  12. I think it's totally normal... Spigot don't know if he should use the 1.9 or the 1.8 method!
  13. Please give me your "Inventory inv =..."
    I need show this
  14. I still want the 1.8 API and i do understand what you mean, i cannot even change the imports for 1.9 as they are all org.bukkit etc.
  15. Inventory inv = e.getInventory();
  16. But inventory no have location, inventory no is entity/livingentity, use e.getRightClicked(),getLocation()
  17. I am using an InventoryClickEvent @Particlees , and i wish to have it so it checks if the Inventory location is null meaning i created the GUI.
  18. Make a simple method:
    public static boolean Chazmondo(Inventory inv){
    return true;
    }catch(Exception ex) {
    return false;

    False is null, true is !null
    After, use
    Inventory inv = e.getInventory();
    if (Chazmondo(inv) == true){
    return; or your code;
    } else {
    created the GUI:
  19. Did not seem to work for me :/ Anyone else?
  20. In "}catch(Exception ex)", replace Exception for your exception, example IOException
Thread Status:
Not open for further replies.