use of net.glowstone.net.message.play.player.CombatEventMessage in project Glowstone by GlowstoneMC.
the class CombatEventCodec method decode.
@Override
public CombatEventMessage decode(ByteBuf buffer) throws IOException {
int eventId = ByteBufUtils.readVarInt(buffer);
Event event = Event.getAction(eventId);
switch(event) {
case END_COMBAT:
{
int duration = ByteBufUtils.readVarInt(buffer);
int entityID = buffer.readInt();
return new CombatEventMessage(event, duration, entityID);
}
case ENTITY_DEAD:
int playerID = ByteBufUtils.readVarInt(buffer);
int entityID = buffer.readInt();
TextMessage message = GlowBufUtils.readChat(buffer);
return new CombatEventMessage(event, playerID, entityID, message);
default:
return new CombatEventMessage(event);
}
}
Aggregations