ProtocolLib 2.0.0

Details

  • Filename
    ProtocolLib-2.0.0.jar
  • Uploaded by
  • Uploaded
    Jan 9, 2013
  • Size
    739.63 KB
  • Downloads
    13,351
  • MD5
    7d9af50b37e70ab887e9394b73aed112

Supported Bukkit Versions

  • CB 1.4.6-R0.3

Changelog

This marks the release of the next major version ProtocolLib, containing a fix for a potential bug and support for NBT tags.

Although this particular update is not breaking nor significant enough to warrant it, I've nevertheless decided to increment the major version. It's long overdue - I should have made this jump before releasing 1.8.0 to emphasize the breaking change in the API (getHandle() now returns Object), but it's too late to change it now.

The main new feature of this update is the ability to modify NBT tags in packets and item stacks, along with reading and writing them to different output formats. For instance, you can now store auxiliary data in an ItemStack very simply:

ItemStack counter = target.getItemInHand();
NbtCompound tag = NbtFactory.asCompound(NbtFactory.fromItemTag(counter));
NbtCompound data = tag.getCompoundOrDefault("com.comphenix.example");
 
// Increment the count
data.put("count", data.getIntegerOrDefault("count") + 1);
sender.sendMessage("Current count: " + data.getInteger("count"));

I've also added an utility class that can serialize and deserialize ItemStacks from byte arrays and strings.

Of course, you can also access and modify the NBT data in packet 132 (Update Tile Entity):

manager.addPacketListener(new PacketAdapter(
  this, ConnectionSide.SERVER_SIDE, Packets.Server.TILE_ENTITY_DATA) {
    @Override
    public void onPacketSending(PacketEvent event) {
        NbtBase<?> nbt = event.getPacket().getNbtModifier().read(0);
        
        System.out.println("Sent " + nbt.toString());
    }
});

New features

Updates

Bug fixes