{
try
{
// If the server is sending a meta-data packet to a sendee player...
// NOTE: That must be the case. We are listening to no other situation.
final PacketContainer packet = event.getPacket();
final Player sendee = event.getPlayer();
// ... fetch the entity ...
// NOTE: MetaData packets are only sent to players in the same world.
final Entity entity = packet.getEntityModifier(sendee.getWorld()).read(0);
// Fireworks cannot have potion effects! They also reuse index 8
// for sending their item stack, causing a crash if we don't bail out now.
if (entity instanceof Firework) return;
// ... fetch the metadata ...
final List<WrappedWatchableObject> metadata = packet.getWatchableCollectionModifier().read(0);
// ... for each watchable in the metadata ...
for (WrappedWatchableObject watchable : metadata)
{
// If the watchable is about potion effect color ...