Solved Player count message

Discussion in 'Spigot Plugin Development' started by Chemi, May 7, 2015.

Thread Status:
Not open for further replies.
  1. I'm using ProtocolLib for it

    Code (Text):
    [18:18:48] [Server thread/ERROR]: Could not load 'plugins\MainSW.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[Spigot.jar:git-Spigot-1649]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:341) ~[Spigot.jar:git-Spigot-1649]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:263) [Spigot.jar:git-Spigot-1649]
        at org.bukkit.craftbukkit.v1_7_R4.CraftServer.loadPlugins(CraftServer.java:369) [Spigot.jar:git-Spigot-1649]
        at org.bukkit.craftbukkit.v1_7_R4.CraftServer.reload(CraftServer.java:864) [Spigot.jar:git-Spigot-1649]
        at org.bukkit.Bukkit.reload(Bukkit.java:301) [Spigot.jar:git-Spigot-1649]
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23) [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 org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchServerCommand(CraftServer.java:753) [Spigot.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.DedicatedServer.aB(DedicatedServer.java:326) [Spigot.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:290) [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]
    Caused by: java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_31]
        at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_31]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[Spigot.jar:git-Spigot-1649]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[Spigot.jar:git-Spigot-1649]
        ... 14 more
    Caused by: java.lang.ClassNotFoundException: com.comphenix.protocol.events.PacketListener
        at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_31]
        at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_31]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_31]
        at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_31]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[Spigot.jar:git-Spigot-1649]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[Spigot.jar:git-Spigot-1649]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_31]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_31]
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_31]
        at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_31]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[Spigot.jar:git-Spigot-1649]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[Spigot.jar:git-Spigot-1649]
        ... 14 more
    [18:18:48] [Server thread/INFO]:
    I'm using ProtocolLib 3.4.0 on a 1.7.10 server.
    Please help.
     
    #1 Chemi, May 7, 2015
    Last edited: Sep 16, 2016
  2. gigosaurus

    Supporter

    Have you added ProtocolLib as a dependency in your plugin.yml?
     
  3. Oh and this is the code for the count player message itself
    Code (Text):
                final List<WrappedGameProfile> names = new ArrayList<WrappedGameProfile>();
                names.add(new WrappedGameProfile("1", ChatColor.LIGHT_PURPLE + "Test"));
                ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL,
                        Arrays.asList(PacketType.Status.Server.OUT_SERVER_INFO), ListenerOptions.ASYNC) {
                        @Override
                        public void onPacketSending(PacketEvent event) {
                            event.getPacket().getServerPings().read(0).setPlayers(names);
                        }
                    });
           
     
  4. Nvm it worked, i added the depend: not right
    Ty!
    [SOLVED!]
     
  5. gigosaurus

    Supporter

    What was the error? When you added the dependency to the yml did it look something like this:

    depend: [ProtocolLib]
     
  6. Ty!
    forgot the :
     
Thread Status:
Not open for further replies.