[Solved] Ilegal AccessError: tried to access class

Discussion in 'Spigot Plugin Development' started by Aurelian6, May 17, 2015.

  1. Hello,

    I have an error with currently code:

    Code (Text):

            for (final PacketType packet : packets) {
                ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(Guardian.instance.getPlugin(),ListenerPriority.NORMAL, packet) {
                    @Override
                    public void onPacketReceiving(PacketEvent event) {
                        if (event.getPacketType() == packet) {
                            Player player = event.getPlayer();
                            if (player == null || !player.isOnline())
                                return;
                            if (!Guardian.instance.manager.contains(player.getUniqueId())) return;
                            BadBlockPlayer bbp = Guardian.instance.manager.get(player);
                            bbp.lastKeepAlive = System.currentTimeMillis();
                        }
                    }
                });
                System.out.println(packet.name() + " packet loaded!");
            }
     
    This line causing error is:
    Code (Text):
    ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(Guardian.instance.getPlugin(),
    Exception is here:
    Code (Text):
    [15:34:22] [Server thread/ERROR]: Error occurred while enabling Guardian v1.0 (Is it up to date?)
    java.lang.IllegalAccessError: tried to access class fr.xmalware.badblock.guardian.KeepAlive$1 from class fr.xmalware.badblock.guardian.KeepAlive
        at fr.xmalware.badblock.guardian.KeepAlive.<init>(KeepAlive.java:44) ~[?:?]
        at fr.xmalware.badblock.guardian.Guardian.registerAll(Guardian.java:163) ~[?:?]
        at fr.xmalware.badblock.guardian.Guardian.onEnable(Guardian.java:87) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:316) ~[spigot.jar:git-Spigot-1649]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [spigot.jar:git-Spigot-1649]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:417) [spigot.jar:git-Spigot-1649]
        at co.technius.PluginManager.PMCommandExecutor.loadCmd(PMCommandExecutor.java:450) [PluginManager.jar:?]
        at co.technius.PluginManager.PMCommandExecutor.onCommand(PMCommandExecutor.java:497) [PluginManager.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) [spigot.jar:git-Spigot-1649]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) [spigot.jar:git-Spigot-1649]
        at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:767) [spigot.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerConnection.java:1043) [spigot.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:880) [spigot.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [spigot.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:65) [spigot.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:186) [spigot.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [spigot.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:734) [spigot.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [spigot.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [spigot.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [spigot.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [spigot.jar:git-Spigot-1649]
    What's wrong with this code to it causes errors?

    Best regards.
     
  2. @Aurelian6 seems that the format got lost in the code block.
     
  3. It's good like this?
     
  4. yes. Does it error when restarting? (so without the PluginManager plugin)
     
  5. Yes.
     
  6. What is the error when restarting?
     
  7. Hello,

    I have changed ProtocolLib version and this work.