Please help. I tried to make a Player Count Message plugin and I got this stacktrace!

Discussion in 'Plugin Development' started by PixBenchMC, Feb 8, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    PixBenchMC

    I tried to make a Player Count Message plugin using ProtocolLib. I watched TheBCBroz's tutorial but I got a stacktrace that I cannot understand! Please help me with it! Here is the stacktrace!


    Code:
    [15:04:14 INFO]: [ProtocolLib] Disabling ProtocolLib v3.4.0
    [15:04:14 ERROR]: Could not load 'plugins\Hub.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/co
    mphenix/protocol/events/PacketListener
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:131) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    java:328) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:251) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.ja
    va:364) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.reload(CraftServer.java:83
    7) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at org.bukkit.Bukkit.reload(Bukkit.java:303) [craftbukkit.jar:git-Bukkit
    -1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:
    23) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
    0) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchCommand(CraftServe
    r.java:740) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchServerCommand(Craf
    tServer.java:726) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at net.minecraft.server.v1_7_R3.DedicatedServer.aB(DedicatedServer.java:
    296) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:2
    61) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:5
    58) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java
    :469) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:6
    28) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
    Caused by: java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketL
    istener
            at java.lang.Class.forName0(Native Method) ~[?:1.7.0_67]
            at java.lang.Class.forName(Unknown Source) ~[?:1.7.0_67]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.jav
    a:40) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:127) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            ... 14 more
    Caused by: java.lang.ClassNotFoundException: com.comphenix.protocol.events.Packe
    tListener
            at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_67]
            at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_67]
            at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_
    67]
            at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.7.0_67]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:77) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_67]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_67]
            at java.lang.Class.forName0(Native Method) ~[?:1.7.0_67]
            at java.lang.Class.forName(Unknown Source) ~[?:1.7.0_67]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.jav
    a:40) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:127) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
            ... 14 more
    [15:04:14 INFO]: [ProtocolLib] Loading ProtocolLib v3.4.0
    [15:04:14 WARN]: [ProtocolLib] Version (MC: 1.7.9) has not yet been tested! Proc
    eed with caution.
    [15:04:14 INFO]: [ProtocolLib] Enabling ProtocolLib v3.4.0
    [15:04:14 INFO]: [ProtocolLib] Started structure compiler thread.
    [15:04:14 INFO]: Server permissions file permissions.yml is empty, ignoring it
    [15:04:14 INFO]: CONSOLE: Reload complete.
    And here is my class:

    Code:
    package Hubs.Hub.Pix;
    
    import com.comphenix.protocol.PacketType;
    import com.comphenix.protocol.ProtocolLibrary;
    import com.comphenix.protocol.events.ListenerOptions;
    import com.comphenix.protocol.events.ListenerPriority;
    import com.comphenix.protocol.events.PacketAdapter;
    import com.comphenix.protocol.events.PacketEvent;
    import com.comphenix.protocol.wrappers.WrappedGameProfile;
    import org.bukkit.ChatColor;
    import org.bukkit.event.Listener;
    import org.bukkit.plugin.java.JavaPlugin;
    
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.List;
    
    @SuppressWarnings({"ResultOfMethodCallIgnored", "RedundantArrayCreation"})
    public class HUB extends JavaPlugin implements Listener {
    
    
    
        private List<WrappedGameProfile> message = new ArrayList<WrappedGameProfile>();
    
        @Override
        public void onEnable() {
            saveConfig();
            getConfig().set("counter.messages", Arrays.asList("First Line", "Second Line"));
            getConfig().set("counter.motd", "This is a MotD");
    
            for (String str : getConfig().getStringList("counter.messages")){
                message.add(new WrappedGameProfile("1", ChatColor.translateAlternateColorCodes('&', str)));
    
                ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, Arrays.asList(new PacketType[]{ PacketType.Status.Server.OUT_SERVER_INFO}), new ListenerOptions[] {ListenerOptions.ASYNC}) {
    
                    public void onPacketSend(PacketEvent event){
                        event.getPacket().getServerPings().read(0).setMotD(getConfig().getString("counter.motd"));
                        event.getPacket().getServerPings().read(0).setVersionName("ยง4PixUTip 1.7 - 1.8");
                        event.getPacket().getServerPings().read(0).setPlayers(message);
                    }
                });
            }
    
        }
    }
    I've used the /reload command!
     
  2. Offline

    timtower Administrator Administrator Moderator

    @PixBenchMC Did you install ProtocolLib on your server?
     
  3. Offline

    PixBenchMC

    @timtower Yes I did install ProtocolLib.
     
  4. Offline

    timtower Administrator Administrator Moderator

    @PixBenchMC Are the library one and the one on the server the same?
     
  5. Offline

    PixBenchMC

    @timtower Yes they are. I have only one ProtocolLib version installed on my PC.
     
  6. @PixBenchMC You really shouldn't follow TheBcBrozs tutorials. In this one though, they do it halfway decent. You're getting the error because your ProtocolLib might be corrupt. It's telling you that it can't find the class com.comphenix.protocol.events.PacketListener. Might be a bug in the new version or something.
     
Thread Status:
Not open for further replies.

Share This Page