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( ~[spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at com.github.patrick.donation.DonationPlugin.onEnable( ~[?:?]
            at ~[spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.plugin.SimplePluginManager.enablePlugin( [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin( [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins( [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.craftbukkit.v1_12_R1.CraftServer.reload( [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.Bukkit.reload( [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.command.defaults.ReloadCommand.execute( [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.command.SimpleCommandMap.dispatch( [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand( [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchServerCommand( [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at net.minecraft.server.v1_12_R1.DedicatedServer.aP( [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at net.minecraft.server.v1_12_R1.DedicatedServer.D( [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at net.minecraft.server.v1_12_R1.MinecraftServer.C( [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
            at [?:1.8.0_231]
    Keep getting this error... What can i do?
  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


    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