diff --git a/Readme.md b/Readme.md
index 900b6f3a..f1ccef0e 100644
--- a/Readme.md
+++ b/Readme.md
@@ -1,7 +1,7 @@
# ProtocolLib
Certain tasks are impossible to perform with the standard Bukkit API, and may require
-working with and even modify Minecraft directly. A common technique is to modify incoming
+working with and even modifying Minecraft directly. A common technique is to modify incoming
and outgoing [packets](https://www.wiki.vg/Protocol), or 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.
@@ -16,15 +16,16 @@ Currently maintained by dmulloy2 on behalf of [Spigot](https://www.spigotmc.org/
* [Resource Page](https://www.spigotmc.org/resources/protocollib.1997/)
* [Dev Builds](https://ci.dmulloy2.net/job/ProtocolLib)
-* [JavaDoc](https://ci.dmulloy2.net/job/ProtocolLib/javadoc)
+* [JavaDoc](https://ci.dmulloy2.net/job/ProtocolLib/javadoc/index.html)
### Compilation
-ProtocolLib is built with Maven and requires Spigot and SpigotAPI, which can be found [here](https://www.spigotmc.org/wiki/buildtools/).
+ProtocolLib is built with [Maven](https://maven.apache.org/). If you have it installed, just run
+`mvn package` in the root project folder.
### A new API
-__ProtocolLib__ attempts to solve this problem by providing a event API, much like Bukkit,
+__ProtocolLib__ attempts to solve this problem by providing an event API, much like Bukkit,
that allows plugins to monitor, modify, or cancel packets sent and received. But, more importantly,
the API also hides all the gritty, obfuscated classes with a simple index based read/write system.
You no longer have to reference CraftBukkit!
@@ -35,7 +36,7 @@ To use this library, first add ProtocolLib.jar to your Java build path. Then, ad
as a dependency or soft dependency to your plugin.yml file like any other plugin:
````yml
-depend: [ProtocolLib]
+depend: [ ProtocolLib ]
````
You can also add ProtocolLib as a Maven dependency:
@@ -46,7 +47,6 @@ You can also add ProtocolLib as a Maven dependency:
dmulloy2-repohttps://repo.dmulloy2.net/repository/public/
- ...
@@ -54,6 +54,7 @@ You can also add ProtocolLib as a Maven dependency:
com.comphenix.protocolProtocolLib4.7.0
+ provided
````
@@ -84,16 +85,14 @@ To listen for packets sent by the server to a client, add a server-side listener
````java
// Disable all sound effects
-protocolManager.addPacketListener(
- new PacketAdapter(this, ListenerPriority.NORMAL,
- PacketType.Play.Server.NAMED_SOUND_EFFECT) {
+protocolManager.addPacketListener(new PacketAdapter(
+ this,
+ ListenerPriority.NORMAL,
+ PacketType.Play.Server.NAMED_SOUND_EFFECT
+) {
@Override
public void onPacketSending(PacketEvent event) {
- // Item packets (id: 0x29)
- if (event.getPacketType() ==
- PacketType.Play.Server.NAMED_SOUND_EFFECT) {
- event.setCancelled(true);
- }
+ event.setCancelled(true);
}
});
````
@@ -103,20 +102,19 @@ censor by listening for Packet3Chat events:
````java
// Censor
-protocolManager.addPacketListener(new PacketAdapter(this,
- ListenerPriority.NORMAL,
- PacketType.Play.Client.CHAT) {
+protocolManager.addPacketListener(new PacketAdapter(
+ this,
+ ListenerPriority.NORMAL,
+ PacketType.Play.Client.CHAT
+) {
@Override
public void onPacketReceiving(PacketEvent event) {
- if (event.getPacketType() == PacketType.Play.Client.CHAT) {
- PacketContainer packet = event.getPacket();
- String message = packet.getStrings().read(0);
+ PacketContainer packet = event.getPacket();
+ String message = packet.getStrings().read(0);
- if (message.contains("shit")
- || message.contains("damn")) {
- event.setCancelled(true);
- event.getPlayer().sendMessage("Bad manners!");
- }
+ if (message.contains("shit") || message.contains("damn")) {
+ event.setCancelled(true);
+ event.getPlayer().sendMessage("Bad manners!");
}
}
});
@@ -127,42 +125,42 @@ protocolManager.addPacketListener(new PacketAdapter(this,
Normally, you might have to do something ugly like the following:
````java
-Packet60Explosion fakeExplosion = new Packet60Explosion();
+PacketPlayOutExplosion fakeExplosion = new PacketPlayOutExplosion(
+ player.getLocation().getX(),
+ player.getLocation().getY(),
+ player.getLocation().getZ(),
+ 3.0F,
+ new ArrayList<>(),
+ new Vec3D(
+ player.getVelocity().getX() + 1,
+ player.getVelocity().getY() + 1,
+ player.getVelocity().getZ() + 1
+ )
+);
-fakeExplosion.a = player.getLocation().getX();
-fakeExplosion.b = player.getLocation().getY();
-fakeExplosion.c = player.getLocation().getZ();
-fakeExplosion.d = 3.0F;
-fakeExplosion.e = new ArrayList