Update dependency info in readme
Dieser Commit ist enthalten in:
Ursprung
2f09dec1c5
Commit
9a108af219
30
Readme.md
30
Readme.md
@ -1,13 +1,13 @@
|
|||||||
# ProtocolLib [![Travis Status](https://travis-ci.org/dmulloy2/ProtocolLib.svg?branch=master)](https://travis-ci.org/dmulloy2/ProtocolLib)
|
# ProtocolLib [![Travis Status](https://travis-ci.org/dmulloy2/ProtocolLib.svg?branch=master)](https://travis-ci.org/dmulloy2/ProtocolLib)
|
||||||
|
|
||||||
Certain tasks are impossible to perform with the standard Bukkit API, and may require
|
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 modify Minecraft directly. A common technique is to modify incoming
|
||||||
and outgoing [packets](http://www.wiki.vg/Protocol), or inject custom packets into the
|
and outgoing [packets](http://www.wiki.vg/Protocol), or inject custom packets into the
|
||||||
stream. This is quite cumbersome to do, however, and most implementations will break
|
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.
|
as soon as a new version of Minecraft has been released, mostly due to obfuscation.
|
||||||
|
|
||||||
Critically, different plugins that use this approach may _hook_ into the same classes,
|
Critically, different plugins that use this approach may _hook_ into the same classes,
|
||||||
with unpredictable outcomes. More than often this causes plugins to crash, but it may also
|
with unpredictable outcomes. More than often this causes plugins to crash, but it may also
|
||||||
lead to more subtle bugs.
|
lead to more subtle bugs.
|
||||||
|
|
||||||
Currently maintained by dmulloy2 on behalf of [Spigot](http://www.spigotmc.org/).
|
Currently maintained by dmulloy2 on behalf of [Spigot](http://www.spigotmc.org/).
|
||||||
@ -24,9 +24,9 @@ ProtocolLib is built with Maven and requires Spigot and SpigotAPI, which can be
|
|||||||
|
|
||||||
### A new API
|
### 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 a event API, much like Bukkit,
|
||||||
that allows plugins to monitor, modify, or cancel packets sent and received. But, more importantly,
|
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.
|
the API also hides all the gritty, obfuscated classes with a simple index based read/write system.
|
||||||
You no longer have to reference CraftBukkit!
|
You no longer have to reference CraftBukkit!
|
||||||
|
|
||||||
### Using ProtocolLib
|
### Using ProtocolLib
|
||||||
@ -52,7 +52,7 @@ You can also add ProtocolLib as a Maven dependency:
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.comphenix.protocol</groupId>
|
<groupId>com.comphenix.protocol</groupId>
|
||||||
<artifactId>ProtocolLib-API</artifactId>
|
<artifactId>ProtocolLib</artifactId>
|
||||||
<version>4.4.0</version>
|
<version>4.4.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
@ -85,12 +85,12 @@ To listen for packets sent by the server to a client, add a server-side listener
|
|||||||
````java
|
````java
|
||||||
// Disable all sound effects
|
// Disable all sound effects
|
||||||
protocolManager.addPacketListener(
|
protocolManager.addPacketListener(
|
||||||
new PacketAdapter(this, ListenerPriority.NORMAL,
|
new PacketAdapter(this, ListenerPriority.NORMAL,
|
||||||
PacketType.Play.Server.NAMED_SOUND_EFFECT) {
|
PacketType.Play.Server.NAMED_SOUND_EFFECT) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent event) {
|
public void onPacketSending(PacketEvent event) {
|
||||||
// Item packets (id: 0x29)
|
// Item packets (id: 0x29)
|
||||||
if (event.getPacketType() ==
|
if (event.getPacketType() ==
|
||||||
PacketType.Play.Server.NAMED_SOUND_EFFECT) {
|
PacketType.Play.Server.NAMED_SOUND_EFFECT) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ censor by listening for Packet3Chat events:
|
|||||||
````java
|
````java
|
||||||
// Censor
|
// Censor
|
||||||
protocolManager.addPacketListener(new PacketAdapter(this,
|
protocolManager.addPacketListener(new PacketAdapter(this,
|
||||||
ListenerPriority.NORMAL,
|
ListenerPriority.NORMAL,
|
||||||
PacketType.Play.Client.CHAT) {
|
PacketType.Play.Client.CHAT) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
@ -128,7 +128,7 @@ Normally, you might have to do something ugly like the following:
|
|||||||
|
|
||||||
````java
|
````java
|
||||||
Packet60Explosion fakeExplosion = new Packet60Explosion();
|
Packet60Explosion fakeExplosion = new Packet60Explosion();
|
||||||
|
|
||||||
fakeExplosion.a = player.getLocation().getX();
|
fakeExplosion.a = player.getLocation().getX();
|
||||||
fakeExplosion.b = player.getLocation().getY();
|
fakeExplosion.b = player.getLocation().getY();
|
||||||
fakeExplosion.c = player.getLocation().getZ();
|
fakeExplosion.c = player.getLocation().getZ();
|
||||||
@ -138,7 +138,7 @@ fakeExplosion.e = new ArrayList<Object>();
|
|||||||
((CraftPlayer) player).getHandle().netServerHandler.sendPacket(fakeExplosion);
|
((CraftPlayer) player).getHandle().netServerHandler.sendPacket(fakeExplosion);
|
||||||
````
|
````
|
||||||
|
|
||||||
But with ProtocolLib, you can turn that into something more manageable. Notice that
|
But with ProtocolLib, you can turn that into something more manageable. Notice that
|
||||||
you don't have to create an ArrayList with this version:
|
you don't have to create an ArrayList with this version:
|
||||||
|
|
||||||
````java
|
````java
|
||||||
@ -164,6 +164,6 @@ One of the main goals of this project was to achieve maximum compatibility with
|
|||||||
result is quite flexible. Aside from netty package changes, it should be resilient against future changes.
|
result is quite flexible. Aside from netty 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.
|
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 -
|
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
|
every field, method and class is deduced by looking at field types, package names or parameter
|
||||||
types. It's remarkably consistent across different versions.
|
types. It's remarkably consistent across different versions.
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren