ProtocolLib 2.6.0

Details

  • Filename
    ProtocolLib-2.6.0.jar
  • Uploaded by
  • Uploaded
    Jul 31, 2013
  • Size
    983.74 KB
  • Downloads
    46,553
  • MD5
    39b4e5f9acaf0be0ea6b2ca899dc199d

Supported Bukkit Versions

  • 1.6.2
  • 1.5.2
  • 1.2.5

Changelog

Build: #115

The previous release (2.5.0) contained a potentially game breaking bug (ticket), so I've opted to expedite the usual monthly release schedule to get it corrected as soon as possible. Plugins affected by this bug may begin spamming the console, though the error message rate limiter should kick in and prevent the server from crashing. I recommend either staying on 2.4.7, or upgrading immediately.

Still, I did manage to cram in a new feature, without having to touch the rest of the code base. That will hopefully prevent a repeat from last time.

PacketContainer now allows you to read and modify the UPDATE_ATTRIBUTE (44) packet, using getAttributeCollectionModifier().

public class ExampleMod extends JavaPlugin {
    private final UUID SPRITING_SPEED = UUID.fromString(
        "662a6b8d-da3e-4c1c-8813-96ea6097278d");
    private final UUID SUPER_SPRINTING = UUID.fromString(
        "d64c79c2-a459-446c-9308-409e1b6b3340");
    
    public void onEnable() {
        ProtocolLibrary.getProtocolManager().addPacketListener(
          new PacketAdapter(PacketAdapter.params(this, 
            Packets.Server.UPDATE_ATTRIBUTES).serverSide()) {
            public void onPacketSending(PacketEvent event) {
                List<WrappedAttribute> list = event.getPacket()
                        .getAttributeCollectionModifier().read(0);

                for (int i = 0; i < list.size(); i++) {
                    WrappedAttribute attribute = list.get(i);

                    // See if we should add the super sprinting
                    // attribute
                    if (attribute.hasModifier(SPRITING_SPEED) && 
                       !attribute.hasModifier(SUPER_SPRINTING)) {
                        Set<WrappedAttributeModifier> modifiers = 
                            Sets.newHashSet(attribute.getModifiers());

                        // Add the new super sprinting too
                        modifiers.add(WrappedAttributeModifier.newBuilder().
                            name("Super Sprinting").uuid(SUPER_SPRINTING).
                            amount(2).
                            operation(Operation.ADD_PERCENTAGE).
                            build());

                        list.set(i, attribute.withModifiers(modifiers));
                    }
                }

                event.getPacket().
                    getAttributeCollectionModifier().write(0, list);
            }
        });
    }
}

This causes sprinting to be 200% faster.

Change log

Features

Bug fixes

Small fixes