NoSuchMethodException Error

Discussion in 'Spigot Plugin Development' started by dvargas135, Jun 22, 2016.

  1. I'm getting this error when I try to hook my plugin with ProtocolLib. Could anyone help?
    Code (Text):
    java.lang.NoSuchMethodException: e.a.b.Aa.<init>(ez.plugins.dan.IeZMain)
        at java.lang.Class.getConstructor0(Class.java:3074) ~[?:1.8.0_25]
        at java.lang.Class.getConstructor(Class.java:1817) ~[?:1.8.0_25]
        at ez.plugins.dan.IeZMain.protocolLibHook(IeZMain.java:195) [eZProtector-YAT-001.jar:?]
        at ez.plugins.dan.IeZMain.onEnable(IeZMain.java:71) [eZProtector-YAT-001.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) [spigot.jar:git-Spigot-db6de12-d3e0b6f]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot.jar:git-Spigot-db6de12-d3e0b6f]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-db6de12-d3e0b6f]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [spigot.jar:git-Spigot-db6de12-d3e0b6f]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [spigot.jar:git-Spigot-db6de12-d3e0b6f]
        at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414) [spigot.jar:git-Spigot-db6de12-d3e0b6f]
        at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378) [spigot.jar:git-Spigot-db6de12-d3e0b6f]
        at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333) [spigot.jar:git-Spigot-db6de12-d3e0b6f]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:263) [spigot.jar:git-Spigot-db6de12-d3e0b6f]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot.jar:git-Spigot-db6de12-d3e0b6f]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_25]

    This is the method on the main class:
    HTML:
    private void protocolLibHook() {
        if (!config.getBoolean(tab-completion.disabled)) {
              return;
        } else {
            if (Bukkit.getPluginManager().isPluginEnabled("ProtocolLib")) {
                try {
                    Class<?> packetClass = Aa.class;
                    Constructor<?> co = packetClass.getConstructor(IeZMain.class);
                    co.newInstance(this);
                    return;
                } catch (Throwable throwable) {
                    throwable.printStackTrace();
                }  
            }
        }
    }
     
  2. What is on line 195?
     
  3. Constructor<?> co = packetClass.getConstructor(IeZMain.class);
     
  4. MiniDigger

    Supporter

    how does the contructor of the class e.a.b.Aa look like? what arguments does it need? you are searching for the constructor that takes a IeZMain object but there doesn't seem to be one.
    Also, why on earth are you testing your plugin with obfuscation?
     
  5. That is actually a very good question lol.
     
  6. im not testing it with obfuscation lol i just renamed that class like that for later adding it as an exception so the obfuscator doesn't screw it up
     
  7. Isn't it the obfuscator's job to do that?
     
  8. MiniDigger

    Supporter

    not if you are unable to configure it right ^^
     
  9. nvm i got it working lol thanks guys and sorry for the inconvenience
     
  10. That's ok, that is why we are here to help! If you figured out yourself, even better!