use of net.glowstone.net.message.play.player.BossBarMessage.Division in project Glowstone by GlowstoneMC.
the class BossBarCodec method decode.
@Override
public BossBarMessage decode(ByteBuf buffer) throws IOException {
UUID uuid = GlowBufUtils.readUuid(buffer);
Action action = Action.fromInt(ByteBufUtils.readVarInt(buffer));
switch(action) {
case ADD:
TextMessage title = GlowBufUtils.readChat(buffer);
float health = buffer.readFloat();
Color color = Color.fromInt(ByteBufUtils.readVarInt(buffer));
Division division = Division.fromInt(ByteBufUtils.readVarInt(buffer));
byte flags = buffer.readByte();
return new BossBarMessage(uuid, action, title, health, color, division, flags);
case REMOVE:
return new BossBarMessage(uuid, action);
case UPDATE_HEALTH:
health = buffer.readFloat();
return new BossBarMessage(uuid, action, health);
case UPDATE_TITLE:
title = GlowBufUtils.readChat(buffer);
return new BossBarMessage(uuid, action, title);
case UPDATE_STYLE:
color = Color.fromInt(ByteBufUtils.readVarInt(buffer));
division = Division.fromInt(ByteBufUtils.readVarInt(buffer));
return new BossBarMessage(uuid, action, color, division);
case UPDATE_FLAGS:
flags = buffer.readByte();
return new BossBarMessage(uuid, action, flags);
}
//INFO: This return is dead code. We would NPE before on the action line.
return null;
}
Aggregations