Solved java.lang.NoSuchMethodError

Discussion in 'Spigot Plugin Development' started by Veteranfighter, Mar 21, 2020.

Thread Status:
Not open for further replies.
  1. I don't understand what this error means... It happens to me when I try to click on something in an inventory.

    Error:
    [Server thread/ERROR]: Could not pass event InventoryClickEvent to Navigator v1.0
    org.bukkit.event.EventException: null
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:320) ~[spigot.jar:git-Spigot-9de398a-9c887d4]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot.jar:git-Spigot-9de398a-9c887d4]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:529) ~[spigot.jar:git-Spigot-9de398a-9c887d4]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:514) ~[spigot.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.PlayerConnection.a(PlayerConnection.java:2133) ~[spigot.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.PacketPlayInWindowClick.a(SourceFile:33) ~[spigot.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.PacketPlayInWindowClick.a(SourceFile:10) ~[spigot.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:19) ~[spigot.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.TickTask.run(SourceFile:18) [spigot.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeTask(SourceFile:144) [spigot.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) [spigot.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeNext(SourceFile:118) [spigot.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.MinecraftServer.aX(MinecraftServer.java:910) [spigot.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.MinecraftServer.executeNext(MinecraftServer.java:903) [spigot.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.awaitTasks(SourceFile:127) [spigot.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.MinecraftServer.sleepForTick(MinecraftServer.java:887) [spigot.jar:git-Spigot-9de398a-9c887d4]
    at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:820) [spigot.jar:git-Spigot-9de398a-9c887d4]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_231]
    Caused by: java.lang.NoSuchMethodError: org.bukkit.inventory.Inventory.getTitle()Ljava/lang/String;
    at de.veteranfighter.navigator.listeners.Navigator.handleNavigatorGUIClick(Navigator.java:64) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_231]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:316) ~[spigot.jar:git-Spigot-9de398a-9c887d4]
    ... 17 more


    Here is my Sourcecode at line 63-65:
    Code (Java):
            if(event.getClickedInventory().getTitle().equals(GUI_PRE)) {
                event.setCancelled(true);
                switch(event.getCurrentItem().getType()) {


     
  2. Inventory#getTitle does not exist in 1.14
    InventoryViews have names though.
     
  3. So which method should I use? Thanks for your help (=
     
  4. Strahan

    Benefactor

    Like he said...
    Get the title from the view.
     
  5. oops didn't saw it
     
  6. Sorry I'm too dumb for that...
    What should I write at [?]
    Code (Text):
            if(event.getClickedInventory().[?]) {
     
  7. event.getview
    javadocs are your best friend
     
  8. Jep >_< thank you :D
     
Thread Status:
Not open for further replies.