ProtocolLib 3.0.1

Details

  • Filename
    ProtocolLib-3.0.1.jar
  • Uploaded by
  • Uploaded
    Dec 10, 2013
  • Size
    1.16 MB
  • Downloads
    30,053
  • MD5
    31e26fa18b4deb661fd17ef14c1894c5

Supported Bukkit Versions

  • 1.7.2
  • 1.6.4
  • 1.5.2

Changelog

Build: #174

ProtocolLib has now been fully updated to run on CraftBukkit and Spigot 1.7.2, together with all the necessary API needed by plugins to read the new packet types. It has undergone extensive testing by hundreds of willing server owners, and I can be reasonably certain the latest version is stable enough for public consumption. This is helped by the fact that Netty is significantly easier to inject into, leading to more performant and stable code.

I would like to extend my sincerest thanks to all of those who put in their time and effort to report any issues. Without them, ProtocolLib wouldn't be half as stable as it is currently.

API

PacketType

Unfortunately, the new 1.7.2 update did affect the core API, and I had to deprecate the entire Packets-class integer enum and all methods that use it or raw integers, as nearly every packet ID have been altered. For instance, Packets.Server.NAMED_ENTITY_SPAWN had the ID 20 in Minecraft 1.6.4 - now it has been changed to ID 12 (0xC). Furthermore, packet IDs are no longer globally unique on the server and the client, meaning that the same ID can be used to represent the packet, such as STEER_VEHICLE (12) on the client side.

Finally, the protocol has now been divided into four separated sub-protocols, each with their own packets. Packet IDs will overlap here as well:

  • HANDSHAKING - Initial state - this can either branch into STATUS or LOGIN.
  • STATUS - Query the server for the current message of the day, players online and the favicon.
  • LOGIN - Setup encryption and transition into PLAY.
  • PLAY - After the player has logged in. The client and server will remain in this protocol for the duration of the game.

All of this prompted me to deprecate the Packets integers (as they no longer apply) with the new PacketType semi-enum class:

ProtocolLibrary.getProtocolManager().addPacketListener(
  new PacketAdapter(this, PacketType.Play.Server.LOGIN) {
    @Override
    public void onPacketSending(PacketEvent event) {
        System.out.println("GameMode: " + 
            event.getPacket().getGameModes().read(0));
        System.out.println("Difficulty: " + 
            event.getPacket().getDifficulties().read(0));
        System.out.println("WorldType: " + 
            event.getPacket().getWorldTypeModifier().read(0));
    }
});

A packet can be accessed in the following fashion:

PacketType.SUB_PROTOCOL.SIDE.NAME_OF_PACKET

As you can see, it is no longer necessary to specify GamePhase, as it is implied by the packet type. You also no longer have to worry about GamePhase, as ProtocolLib will infer it in 1.6.4, and it has been made irrelevant in 1.7.2.

Additions to PacketContainer

I have also added a number of new modifiers to accommodate changes in the packet classes:

  • getBlocks()
  • getGameProfiles()
  • getChatComponents()
  • getServerPings()
  • getProtocols()
  • getClientCommands()
  • getChatVisibilities()
  • getDifficulties()
  • getEntityUseActions()
  • getGameModes()

Here, ServerPing is a high-level wrapper around ServerPing, and allows you to modify the appearance of your server in the server menu to a great detail. You can set the player ratio, the name of the players displayed when you hover over the server, or even change the favicon (server image), all with a relatively simple API.

There is also a ChatComponent wrapper. It is not as powerful as ServerPing, but it will allow you to get and change the raw JSON string that is transmitted when the server sends a message to the client.

Changes

  • Updated ProtocolLib to Minecraft 1.7.4 (version 3.0.1)
  • See GitHub for more details.