ProtocolLib

3M Downloads

I tryed to start with you plugin but i cant even follow a guid i only get Error:

Countiblader opened this issue ยท 1 comments

commented

This is the Code:

package de.counti.test_protocolLip2;

import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;

public final class Test_protocolLip2 extends JavaPlugin {

@Override
public void onEnable() {

    ProtocolManager manager = ProtocolLibrary.getProtocolManager();
    manager.addPacketListener(new PacketAdapter(Test_protocolLip2.getPlugin(), ListenerPriority.NORMAL, PacketType.Play.Client.POSITION) {
        @Override
        public void onPacketReceiving(PacketEvent event) {
            PacketContainer packet = event.getPacket();
            Player p = event.getPlayer();
            double x = packet.getDoubles().read(0);
            double y = packet.getDoubles().read(1);
            double z = packet.getDoubles().read(2);
            p.sendMessage("X: " + x + " Y: " + y + " Z: " + z);
        }
    });
}

private static Plugin getPlugin() {
    return Bukkit.getPluginManager().getPlugin("Test_protocolLib2");
}

@Override
public void onDisable() {
    // Plugin shutdown logic
}

}

Error:
[13:31:54 ERROR]: [ModernPluginLoadingStrategy] Could not load plugin 'test_protocolLip2-1.0-SNAPSHOT.jar' in folder 'plugins'
java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:467) ~[?:?]
at io.papermc.paper.plugin.provider.util.ProviderUtil.loadClass(ProviderUtil.java:51) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.provider.util.ProviderUtil.loadClass(ProviderUtil.java:29) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.provider.type.paper.PaperPluginParent$PaperServerPluginProvider.createInstance(PaperPluginParent.java:169) ~[paper-1.20.4.jar:git-Paper-497]
at io.papermc.paper.plugin.provider.type.paper.PaperPluginParent$PaperServerPluginProvider.createInstance(PaperPluginParent.java:139) ~[paper-1.20.4.jar:git-Paper-497]
at io.papermc.paper.plugin.entrypoint.strategy.modern.ModernPluginLoadingStrategy.loadProviders(ModernPluginLoadingStrategy.java:116) ~[paper-1.20.4.jar:git-Paper-497]
at io.papermc.paper.plugin.storage.SimpleProviderStorage.enter(SimpleProviderStorage.java:38) ~[paper-1.20.4.jar:git-Paper-497]
at io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enter(LaunchEntryPointHandler.java:36) ~[paper-1.20.4.jar:git-Paper-497]
at org.bukkit.craftbukkit.v1_20_R3.CraftServer.loadPlugins(CraftServer.java:507) ~[paper-1.20.4.jar:git-Paper-497]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:274) ~[paper-1.20.4.jar:git-Paper-497]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1131) ~[paper-1.20.4.jar:git-Paper-497]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[paper-1.20.4.jar:git-Paper-497]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.ClassNotFoundException: com.comphenix.protocol.events.PacketListener
at io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader.loadClass(PaperPluginClassLoader.java:142) ~[paper-1.20.4.jar:git-Paper-497]
at io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader.loadClass(PaperPluginClassLoader.java:103) ~[paper-1.20.4.jar:git-Paper-497]
at java.lang.ClassLoader.loadClass(ClassLoader.java:525) [?:?]
... 14 more
[13:31:54 INFO]: [LuckPerms] Loading server plugin LuckPerms v5.4.141
[13:31:55 INFO]: [ProtocolLib] Loading server plugin ProtocolLib v5.2.0-SNAPSHOT-679
[13:31:57 INFO]: Server permissions file permissions.yml is empty, ignoring it
[13:31:57 INFO]: [LuckPerms] Enabling LuckPerms v5.4.141
[13:31:57 INFO]: __
[13:31:57 INFO]: | |) LuckPerms v5.4.141
[13:31:57 INFO]: |
_ | Running on Bukkit - Paper
[13:31:57 INFO]:
[13:31:57 INFO]: [LuckPerms] Loading configuration...
[13:31:58 INFO]: [LuckPerms] Loading storage provider... [H2]
[13:31:58 INFO]: [LuckPerms] Loading internal permission managers...
[13:31:58 INFO]: [LuckPerms] Performing initial data load...
[13:31:59 INFO]: [LuckPerms] Successfully enabled. (took 1849ms)
[13:31:59 INFO]: [ProtocolLib] Enabling ProtocolLib v5.2.0-SNAPSHOT-679
[13:31:59 INFO]: Preparing level "world"
[13:31:59 INFO]: Preparing start region for dimension minecraft:overworld
[13:32:01 INFO]: Time elapsed: 1700 ms
[13:32:01 INFO]: Preparing start region for dimension minecraft:the_nether
[13:32:01 INFO]: Time elapsed: 128 ms
[13:32:01 INFO]: Preparing start region for dimension minecraft:the_end
[13:32:01 INFO]: Time elapsed: 66 ms
[13:32:01 INFO]: Running delayed init tasks
[13:32:01 INFO]: Done (9.275s)! For help, type "help"
container@mh-cloud
Server markiert als running...
[13:32:01 INFO]: Timings Reset

commented

This happens because your plugin fails to find ProtocolLib's classes.

Please verify your setup:

  1. Check that ProtocolLib (the lastest dev build if using MC 1.20.5+) is present in your plugins folder.
  2. Check your Dependency Management (Gradle or Maven): you can try to create a Fat Jar using either to include ProtocoLib inside your plugin directly. Please remember to shade the packages to avoid clashing with other plugins.