02-03-2016, 08:02 PM
someone can help how i can fix this bug chat
when i send msg to chat he send this bug
when i send msg to chat he send this bug
Код:
public class SM_CHAT_LOBBY_MESSAGE extends ServerPacket {
private Player player;
private String message;
public SM_CHAT_LOBBY_MESSAGE(Player player, String message) {
super(0xC15);
this.player = player;
this.message = message;
}
@Override
public void writeImpl() {
writeD(player.getConnection().getId());
int length = player.getName().length() > player.MAX_NAME_SIZE ? player.MAX_NAME_SIZE : player.getName().length();
writeC(length);
writeS(player.getName().length() > length ? player.getName().substring(0, length) : player.getName());
writeC(player.getColor());
writeH(message.length());
writeS(message);
}
}
Код:
public class SM_CHAT_TEAM_MESSAGE extends ServerPacket {
private RoomSlot slot;
private String message;
private ChatType type;
public SM_CHAT_TEAM_MESSAGE(RoomSlot slot, ChatType type, String message) {
super(0xF0B);
this.slot = slot;
this.type = type;
this.message = message;
}
@Override
public void writeImpl() {
writeH(type.getValue());
writeD(slot.getId());
writeD(message.length());
writeS(message);
}
}