Commit 9af9177b by Jonathan Thomas

Yet another fix for a player message regression due to all this refactoring of player data.

parent d435b21a
Pipeline #13206 passed with stages
in 2 minutes 9 seconds
......@@ -102,7 +102,7 @@ public class ClientPackets {
// Read the data from the server packet
UUID entityId = UUID.fromString(buffer.readString());
UUID playerId = UUID.fromString(buffer.readString());
String playerName =buffer.readString(32767);
String playerName = buffer.readString(32767);
String message = buffer.readString(32767);
int line = buffer.readInt();
String status_name = buffer.readString(32767);
......@@ -124,7 +124,7 @@ public class ClientPackets {
PlayerData playerData = chatData.getPlayerData(playerName);
playerData.friendship = friendship;
if (chatData.sender == ChatDataManager.ChatSender.USER) {
if (chatData.sender == ChatDataManager.ChatSender.USER && chatData.status == ChatDataManager.ChatStatus.DISPLAY) {
// Add player message to queue for rendering
PlayerMessageManager.addMessage(playerId, playerName, chatData.currentMessage, ChatDataManager.TICKS_TO_DISPLAY_USER_MESSAGE);
}
......
......@@ -480,14 +480,19 @@ public class BubbleRenderer {
PlayerData playerData = null;
if (entity instanceof MobEntity) {
chatData = ChatDataManager.getClientInstance().getOrCreateChatData(entity.getUuidAsString(), player.getDisplayName().getString());
if (chatData != null) {
playerData = chatData.getPlayerData(player.getDisplayName().getString());
}
} else if (entity instanceof PlayerEntity) {
PlayerEntity playerEntity = (PlayerEntity) entity;
chatData = PlayerMessageManager.getMessage(entity.getUuid());
if (chatData != null) {
playerData = chatData.getPlayerData(playerEntity.getDisplayName().getString());
}
}
// Get playerData: friendship (if any)
if (chatData != null) {
playerData = chatData.getPlayerData(player.getDisplayName().getString());
} else {
// Don't allow a null playerData
if (playerData == null) {
playerData = new PlayerData();
}
......
......@@ -359,7 +359,7 @@ public class ServerPackets {
buffer.writeString(chatData.sender.toString());
buffer.writeInt(playerData.friendship);
LOGGER.debug("Server broadcast message to client: " + player.getName().getString() + " | Message: " + chatData.currentMessage);
LOGGER.debug("Server broadcast message to client: " + player.getName().getString() + " | Status: " + chatData.status.toString() + " | Message: " + chatData.currentMessage);
ServerPlayNetworking.send(player, PACKET_S2C_MESSAGE, buffer);
}
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment