Check if entity is FireWork. Fixes #5 and #6. Thanks aadnk.

This commit is contained in:
Olof Larsson 2013-05-26 11:22:29 +02:00
parent 2a97b2a697
commit 9b0e112a5c

View File

@ -3,6 +3,7 @@ package com.massivecraft.mcore.integration.protocollib;
import java.util.List; import java.util.List;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.comphenix.protocol.Packets; import com.comphenix.protocol.Packets;
@ -52,6 +53,10 @@ public class EntityPotionColorPacketAdapter extends PacketAdapter
// NOTE: MetaData packets are only sent to players in the same world. // NOTE: MetaData packets are only sent to players in the same world.
final Entity entity = packet.getEntityModifier(sendee.getWorld()).read(0); 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 ... // ... fetch the metadata ...
final List<WrappedWatchableObject> metadata = packet.getWatchableCollectionModifier().read(0); final List<WrappedWatchableObject> metadata = packet.getWatchableCollectionModifier().read(0);