ProtocolLib
- Tested Minecraft Versions:
- 1.8
- 1.9
- 1.10
- 1.11
- 1.12
- 1.13
- 1.14
- Source Code:
- https://github.com/dmulloy2/ProtocolLib/
- Contributors:
- dmulloy2 and aadnk
If you're running 1.14, use the latest dev build.
If you're running 1.8 through 1.13, use the latest release.
If you're running 1.7 or below, use the 3.7.0 release.
Thanks for over 400k downloads everyone!
If you love ProtocolLib or it has made your life significantly easier, consider donating or leaving a positive review below. It really means a lot!
Certain tasks are impossible to perform with the standard Bukkit API and may require working with and even modifying Minecraft directly. A common technique is to modify incoming and outgoing packets or to inject custom packets into the stream. This is quite cumbersome to do, however, and most implementations will break as soon as a new version of Minecraft has been released, mostly due to obfuscation.
ProtocolLib is a library that allows read and write access to the Minecraft protocol. It handles most of the overhead required with reflection and channel injection and provides wrappers to simplify packet modification. It is updated with most Minecraft updates so, ideally, individual plugins don't have to. ProtocolLib often doesn't need to be updated for minor updates, especially if there are few code changes (i.e. the 1.8 security updates)
Useful Links
Support
Before reporting a bug:
When reporting a bug:
- Look for an update for ProtocolLib, there's a good chance your error or bug has already been fixed.
- Read the stack trace and make sure it's an error with ProtocolLib. ProtocolLib's package is com.comphenix.protocol. If you don't see that anywhere, it's not ProtocolLib.
For server operators
- I'd prefer it if you used the issue tracker, but you can also do this in the discussion section. Don't report bugs in the reviews.
- Provide as much information as possible. Provide your ProtocolLib version and Spigot version.
- Provide any stack traces or "errors" using pastebin.
Just download ProtocolLib from the link above. It doesn't do anything on its own, it simply allows other plugins to function.
For developers
A comprehensive tutorial can be found here.
TinyProtocol
There is a lightweight alternative to ProtocolLib called TinyProtocol. It is essentially a mechanism to send and receive raw packets without structure modifiers or wrappers. It can be found here.
Maven repository
If you're using Maven, you'll be able to automatically download the jar, JavaDoc and associated sources from the following repository:
Gradle:HTML:<repositories>
<repository>
<id>dmulloy2-repo</id>
<url>http://repo.dmulloy2.net/nexus/repository/public/</url>
</repository>
<!-- And so on -->
</repositories>
Code (Java):repositories {
maven { url "http://repo.dmulloy2.net/nexus/repository/public/" }
}
Then add it as a dependency like so:
Gradle:HTML:<dependencies>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.4.0</version>
</dependency>
<!-- And so on -->
</dependencies>
Developers are encouraged to use the ProtocolLib module as a dependency as of version 4.4.0. ProtocolLib-API was a fun experiment, but had some unfortunate linkage errors.Code (Java):dependencies {
compileOnly group: "com.comphenix.protocol", name: "ProtocolLib", version: "4.4.0";
}
Commands
Protocol
Main administrative command. Supports the following sub-commands:
PacketLog
- config: Reload the configuration file.
- check: Check for new versions on BukkitDev.
- version: Displays the currently running version of ProtocolLib.
- timings: Toggle measuring the amount of CPU time spent by each plugin.
- listeners: Display what plugins are using ProtocolLib, and the packet types they are intercepting.
Logs hex representations of the provided packets to a file or to console
Syntax: /packetlog <protocol> <sender> <packet> [file/console]
Accepted packets can be found here.
All of these commands require the permission protocol.admin.
Configuration
A small set of configuration options are available:
Global section
CompatibilityCode (YAML):auto updater.notify: true #Inform any player with the permission protocol.info when a new version of ProtocolLib is out.
auto updater.download: false #Automatically download and install the newest version of ProtocolLib. The installation will take effect when the server restarts.
auto updater.delay: 43200 #The number of seconds between each check for a new update.
auto updater.last: 0 #This simply records the last time (in seconds since 01.01.1970) an update check was performed. Set it to 0 to force a new update check.
metrics: true #If TRUE, ProtocolLib will publish anonymous usage data to mcstats.org. Set it to FALSE to opt-out.
background compiler: true #If TRUE, ProtocolLib will try and improve performance by replacing reflection with compiled code on-the-fly.
ignore version check: None #Force ProtocolLib to start for a specified Minecraft version, even if it is incompatible.
One of the main goals of this project was to achieve maximum compatibility with CraftBukkit. And the end result is quite flexible. Aside from package changes, it should be resilient against future changes. It's likely that I won't have to update ProtocolLib for anything but bug fixes and new features.
How is this possible? It all comes down to reflection in the end. Essentially, no name is hard coded - every field, method and class is deduced by looking at field types, package names or parameter types. It's remarkably consistent across different versions.
Statistics
ProtocolLib collects statistics anonymously through MCStats. Participation is completely optional and you can opt-out at any time, although it is really helpful in figuring out what environments the plugin is running in (i.e. versions of Spigot, Java, and ProtocolLib), so I can adjust development accordingly.
Donations
If ProtocolLib has made your life significantly easier or you're feeling particularly generous, consider donating! It's a great way to support the many hours I've spent maintaining this plugin and keeps me motivated. Don't donate if you can't afford it.
![]()
Huge thanks to those who have donated!
(If I missed you or you want to remain anonymous, shoot me a PM)
Please don't leave bug reports in the reviews section. It's the single worst place to get support. Use the issue tracker, where I can actually diagnose and fix your issue.
- nathan818 - $1000
- MineCove - $100
- joehot200 - $75
- Techcable - $30
- VintageDon - $25
- games647 - $25
- Photon - $15
- Axzial - $10
- snapsi - $5
- Aberzhulan - $5
- Art in the Shade - $5
ProtocolLib 4.4.0
Provides read/write access to the Minecraft protocol
-
SkayM, TomCreeper, KingVocalWolf and 58 others like this.
Recent Updates
- ProtocolLib v4.4.0 Sep 22, 2018
- ProtocolLib v4.3.0 Jun 14, 2017
- ProtocolLib v4.2.1 Apr 10, 2017
Recent Reviews
-
FendiTony777Version: 4.4.0- 5/5,
Don't know what it does but it works fine! It is required by many plugins nowadays!
-
RicochetBenVersion: 4.4.0- 5/5,
One of those plugins that you can't get away with not having nowadays. I give this an epic/10
-
AlonsoSBVersion: 4.4.0- 5/5,
ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
-
ImM7mqdVersion: 4.4.0- 5/5,
OMG super helpful with out this plugin my server would be like trash
<333333333333333333333 -
joehot200Version: 4.4.0- 5/5,
Excellent resource as always. Makes hundreds of plugins possible and much easier to develop, including my own. Much love <3.
-
_MrCrafteru_Version: 4.4.0- 5/5,
Great plugin, but I have one problem. I have a plugin bad work gives the big error.
Caused by: java.lang.NoClassDefFoundError: com.comphenix.protocol.injector.PacketConstructor (initialization failure)
at java.lang.J9VMInternals.initializationAlreadyFailed(J9VMInternals.java:98) ~[?:1.8.0_212]
at com.comphenix.protocol.injector.BukkitUnwrapper.unwrapItem(BukkitUnwrapper.java:100) ~[?:?]
at com.comphenix.protocol.utility.MinecraftFields.getNetworkManager(MinecraftFields.java:29) ~[?:?]
at com.comphenix.protocol.injector.netty.InjectionFactory.fromPlayer(InjectionFactory.java:84) ~[?:?]
at com.comphenix.protocol.injector.netty.ProtocolInjector$4.handleDisconnect(ProtocolInjector.java:424) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager.onPlayerQuit(PacketFilterManager.java:1029) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager.access$800(PacketFilterManager.java:77) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager$4.onPlayerQuit(PacketFilterManager.java:991) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:312) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
... 12 more
Caused by: java.lang.BootstrapMethodError: java.lang.ExceptionInInitializerError
at com.comphenix.protocol.wrappers.BukkitConverters.getWrappedStatisticConverter(BukkitConverters.java:693) ~[?:?]
at com.comphenix.protocol.wrappers.BukkitConverters.getConvertersForGeneric(BukkitConverters.java:1012) ~[?:?]
at com.comphenix.protocol.wrappers.BukkitConverters.getUnwrappers(BukkitConverters.java:1031) ~[?:?]
at com.comphenix.protocol.injector.PacketConstructor.<init>(PacketConstructor.java:62) ~[?:?]
at com.comphenix.protocol.injector.PacketConstructor.<clinit>(PacketConstructor.java:45) ~[?:?]
at com.comphenix.protocol.injector.BukkitUnwrapper.unwrapItem(BukkitUnwrapper.java:100) ~[?:?]
at com.comphenix.protocol.utility.MinecraftFields.getNetworkManager(MinecraftFields.java:29) ~[?:?]
at com.comphenix.protocol.injector.netty.InjectionFactory.fromPlayer(InjectionFactory.java:84) ~[?:?]
at com.comphenix.protocol.injector.netty.ProtocolInjector$4.updatePlayer(ProtocolInjector.java:368) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager.onPlayerLogin(PacketFilterManager.java:1003) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager.access$500(PacketFilterManager.java:77) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager$4.onPlayerLogin(PacketFilterManager.java:976) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:312) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:66) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:507) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:492) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.PlayerList.attemptLogin(PlayerList.java:531) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.LoginListener.b(LoginListener.java:129) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.LoginListener.tick(LoginListener.java:53) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.NetworkManager.a(NetworkManager.java:230) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.ServerConnection.c(ServerConnection.java:119) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
... 5 more
Caused by: java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.ensureError(J9VMInternals.java:148) ~[?:1.8.0_212]
at java.lang.J9VMInternals.recordInitializationFailure(J9VMInternals.java:137) ~[?:1.8.0_212]
at java.lang.invoke.MethodHandle.getCPMethodHandleAt(Native Method) ~[?:1.8.0_212]
at java.lang.invoke.MethodHandle.resolveInvokeDynamic(MethodHandle.java:838) ~[?:1.8.0_212]
at com.comphenix.protocol.wrappers.BukkitConverters.getWrappedStatisticConverter(BukkitConverters.java:693) ~[?:?]
at com.comphenix.protocol.wrappers.BukkitConverters.getConvertersForGeneric(BukkitConverters.java:1012) ~[?:?]
at com.comphenix.protocol.wrappers.BukkitConverters.getUnwrappers(BukkitConverters.java:1031) ~[?:?]
at com.comphenix.protocol.injector.PacketConstructor.<init>(PacketConstructor.java:62) ~[?:?]
at com.comphenix.protocol.injector.PacketConstructor.<clinit>(PacketConstructor.java:45) ~[?:?]
at com.comphenix.protocol.injector.BukkitUnwrapper.unwrapItem(BukkitUnwrapper.java:100) ~[?:?]
at com.comphenix.protocol.utility.MinecraftFields.getNetworkManager(MinecraftFields.java:29) ~[?:?]
at com.comphenix.protocol.injector.netty.InjectionFactory.fromPlayer(InjectionFactory.java:84) ~[?:?]
at com.comphenix.protocol.injector.netty.ProtocolInjector$4.updatePlayer(ProtocolInjector.java:368) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager.onPlayerLogin(PacketFilterManager.java:1003) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager.access$500(PacketFilterManager.java:77) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager$4.onPlayerLogin(PacketFilterManager.java:976) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:312) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:66) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:507) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:492) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.PlayerList.attemptLogin(PlayerList.java:531) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.LoginListener.b(LoginListener.java:129) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.LoginListener.tick(LoginListener.java:53) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.NetworkManager.a(NetworkManager.java:230) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.ServerConnection.c(ServerConnection.java:119) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
... 5 more
Caused by: java.lang.IllegalArgumentException: Unable to find findStatistic in net.minecraft.server.v1_13_R2.StatisticList
at com.comphenix.protocol.reflect.FuzzyReflection.getMethodByParameters(FuzzyReflection.java:280) ~[?:?]
at com.comphenix.protocol.wrappers.WrappedStatistic.<clinit>(WrappedStatistic.java:22) ~[?:?]
at java.lang.invoke.MethodHandle.getCPMethodHandleAt(Native Method) ~[?:1.8.0_212]
at java.lang.invoke.MethodHandle.resolveInvokeDynamic(MethodHandle.java:838) ~[?:1.8.0_212]
at com.comphenix.protocol.wrappers.BukkitConverters.getWrappedStatisticConverter(BukkitConverters.java:693) ~[?:?]
at com.comphenix.protocol.wrappers.BukkitConverters.getConvertersForGeneric(BukkitConverters.java:1012) ~[?:?]
at com.comphenix.protocol.wrappers.BukkitConverters.getUnwrappers(BukkitConverters.java:1031) ~[?:?]
at com.comphenix.protocol.injector.PacketConstructor.<init>(PacketConstructor.java:62) ~[?:?]
at com.comphenix.protocol.injector.PacketConstructor.<clinit>(PacketConstructor.java:45) ~[?:?]
at com.comphenix.protocol.injector.BukkitUnwrapper.unwrapItem(BukkitUnwrapper.java:100) ~[?:?]
at com.comphenix.protocol.utility.MinecraftFields.getNetworkManager(MinecraftFields.java:29) ~[?:?]
at com.comphenix.protocol.injector.netty.InjectionFactory.fromPlayer(InjectionFactory.java:84) ~[?:?]
at com.comphenix.protocol.injector.netty.ProtocolInjector$4.updatePlayer(ProtocolInjector.java:368) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager.onPlayerLogin(PacketFilterManager.java:1003) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager.access$500(PacketFilterManager.java:77) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager$4.onPlayerLogin(PacketFilterManager.java:976) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:312) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:66) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:507) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:492) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.PlayerList.attemptLogin(PlayerList.java:531) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.LoginListener.b(LoginListener.java:129) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.LoginListener.tick(LoginListener.java:53) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.NetworkManager.a(NetworkManager.java:230) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
at net.minecraft.server.v1_13_R2.ServerConnection.c(ServerConnection.java:119) ~[spigot-1.13.2.jar:git-Spigot-1a3504a-dfa7583]
And when I go to the server and quickly he kicks me. What to do? Please fix the plugin. I have version 1.13.2 -
SkyHeroesDada11Version: 4.4.0- 3/5,
Not work for me.. idk why
https://www.spigotmc.org/threads/protocollib-not-work.378877/ -
Pankraz01Version: 4.4.0- 5/5,
very good library for awesome plugins. since launch the must have plugin on my servers
-
WeaselBeansVersion: 4.4.0- 5/5,
Very good plugin, essential for many things. Please continue to support/improve this.
-
XanDorkYTVersion: 4.4.0- 5/5,
this is an epic gamer plugin, so many great plugins would not exist without it. thank you kanye very cool
