Need Help on IllegalPluginAccessException

Discussion in 'Spigot Plugin Help' started by PatrickKR, Mar 5, 2020.

  1. Code (Text):
    [11:52:40 ERROR]: Error occurred while enabling DonationSurvive v1.0 (Is it up to date?)
    org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register [email protected] while not enabled
            at org.bukkit.plugin.SimplePluginManager.registerEvents(SimplePluginManager.java:522) ~[spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at com.github.patrick.donation.DonationPlugin.onEnable(DonationPlugin.java:31) ~[?:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:337) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:403) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:381) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:330) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.craftbukkit.v1_12_R1.CraftServer.reload(CraftServer.java:752) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.Bukkit.reload(Bukkit.java:525) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:648) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchServerCommand(CraftServer.java:634) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at net.minecraft.server.v1_12_R1.DedicatedServer.aP(DedicatedServer.java:444) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:407) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231]
    Keep getting this error... What can i do?
    Source: https://github.com/patrick-mc/donation-survive
     
  2. Believe your issue is with the isEnabled code in the main class. Since it's not fully enabled, it might be throwing false. Try getting rid of that and see what happens.
     
  3. Choco

    Moderator

    isEnabled() will return true. Is it a necessary check? No, absolutely not. Though that's not the issue at hand.

    @OP the issue is that your DonationClient#connect() method is returning false, meaning this block of code gets executed and disables your plugin. However, because you do not return when your plugin disables, the rest of your onEnable() (including the registration of your events) is getting called and throwing this exception. So 2 things:
    1. If you disable your plugin on enable, ensure the rest of your onEnable() method is not called by returning and halting execution. (add a return statement after disable)
    2. Figure out why your connect() method is returning false
     
  4. Guess I found the issue
    I forgot to configure config.yml properly and that caused the connect() return false. I'll try to configure it first