Packet packet = e.getPacket();
ViewerEffectPacket effect = (ViewerEffectPacket)packet;
for (ViewerEffectPacket.EffectBlock block : effect.Effect)
{
EffectType type = EffectType.get(block.Type);
// Each ViewerEffect type uses it's own custom binary format for additional data. Fun eh?
switch (type)
{
case Text:
JLogger.warn("Received a ViewerEffect of type " + type.toString() + ", implement me!");
break;
case Icon:
JLogger.warn("Received a ViewerEffect of type " + type.toString() + ", implement me!");
break;
case Connector:
JLogger.warn("Received a ViewerEffect of type " + type.toString() + ", implement me!");
break;
case FlexibleObject:
JLogger.warn("Received a ViewerEffect of type " + type.toString() + ", implement me!");
break;
case AnimalControls:
JLogger.warn("Received a ViewerEffect of type " + type.toString() + ", implement me!");
break;
case AnimationObject:
JLogger.warn("Received a ViewerEffect of type " + type.toString() + ", implement me!");
break;
case Cloth:
JLogger.warn("Received a ViewerEffect of type " + type.toString() + ", implement me!");
break;
case Glow:
JLogger.warn("Received a Glow ViewerEffect which is not implemented yet");
break;
case Beam:
case Point:
case Trail:
case Sphere:
case Spiral:
case Edit:
if (onViewerEffect != null)
{
if (block.TypeData.length == 56)
{
UUID sourceAvatar = new UUID(block.TypeData, 0);
UUID targetObject = new UUID(block.TypeData, 16);
Vector3d targetPos = new Vector3d(block.TypeData, 32);
onViewerEffect.raiseEvent(new ViewerEffectEventArgs(type, sourceAvatar, targetObject, targetPos, block.Duration, block.ID));
}
else
{
JLogger.warn("Received a " + type.toString() +
" ViewerEffect with an incorrect TypeData size of " +
block.TypeData.length + " bytes");
}
}
break;