use of net.glowstone.util.TextMessage in project Glowstone by GlowstoneMC.
the class GlowPlayer method setPlayerListName.
@Override
public void setPlayerListName(String name) {
// update state
playerListName = name;
// send update message
TextMessage displayName = null;
if (playerListName != null && !playerListName.isEmpty()) {
displayName = new TextMessage(playerListName);
}
updateUserListEntries(UserListItemMessage.displayNameOne(getUniqueId(), displayName));
}
use of net.glowstone.util.TextMessage 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;
}
use of net.glowstone.util.TextMessage in project Glowstone by GlowstoneMC.
the class UpdateSignCodec method decode.
@Override
public UpdateSignMessage decode(ByteBuf buf) throws IOException {
BlockVector pos = GlowBufUtils.readBlockPosition(buf);
TextMessage[] message = new TextMessage[4];
for (int i = 0; i < message.length; ++i) {
message[i] = GlowBufUtils.readChat(buf);
}
return new UpdateSignMessage(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), message);
}
use of net.glowstone.util.TextMessage in project Glowstone by GlowstoneMC.
the class UserListHeaderFooterCodec method decode.
@Override
public UserListHeaderFooterMessage decode(ByteBuf buffer) throws IOException {
TextMessage header = GlowBufUtils.readChat(buffer);
TextMessage footer = GlowBufUtils.readChat(buffer);
return new UserListHeaderFooterMessage(header, footer);
}
Aggregations