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 { ...@@ -102,7 +102,7 @@ public class ClientPackets {
// Read the data from the server packet // Read the data from the server packet
UUID entityId = UUID.fromString(buffer.readString()); UUID entityId = UUID.fromString(buffer.readString());
UUID playerId = 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); String message = buffer.readString(32767);
int line = buffer.readInt(); int line = buffer.readInt();
String status_name = buffer.readString(32767); String status_name = buffer.readString(32767);
...@@ -124,7 +124,7 @@ public class ClientPackets { ...@@ -124,7 +124,7 @@ public class ClientPackets {
PlayerData playerData = chatData.getPlayerData(playerName); PlayerData playerData = chatData.getPlayerData(playerName);
playerData.friendship = friendship; 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 // Add player message to queue for rendering
PlayerMessageManager.addMessage(playerId, playerName, chatData.currentMessage, ChatDataManager.TICKS_TO_DISPLAY_USER_MESSAGE); PlayerMessageManager.addMessage(playerId, playerName, chatData.currentMessage, ChatDataManager.TICKS_TO_DISPLAY_USER_MESSAGE);
} }
......
...@@ -480,14 +480,19 @@ public class BubbleRenderer { ...@@ -480,14 +480,19 @@ public class BubbleRenderer {
PlayerData playerData = null; PlayerData playerData = null;
if (entity instanceof MobEntity) { if (entity instanceof MobEntity) {
chatData = ChatDataManager.getClientInstance().getOrCreateChatData(entity.getUuidAsString(), player.getDisplayName().getString()); chatData = ChatDataManager.getClientInstance().getOrCreateChatData(entity.getUuidAsString(), player.getDisplayName().getString());
if (chatData != null) {
playerData = chatData.getPlayerData(player.getDisplayName().getString());
}
} else if (entity instanceof PlayerEntity) { } else if (entity instanceof PlayerEntity) {
PlayerEntity playerEntity = (PlayerEntity) entity;
chatData = PlayerMessageManager.getMessage(entity.getUuid()); chatData = PlayerMessageManager.getMessage(entity.getUuid());
if (chatData != null) {
playerData = chatData.getPlayerData(playerEntity.getDisplayName().getString());
}
} }
// Get playerData: friendship (if any) // Don't allow a null playerData
if (chatData != null) { if (playerData == null) {
playerData = chatData.getPlayerData(player.getDisplayName().getString());
} else {
playerData = new PlayerData(); playerData = new PlayerData();
} }
......
...@@ -359,7 +359,7 @@ public class ServerPackets { ...@@ -359,7 +359,7 @@ public class ServerPackets {
buffer.writeString(chatData.sender.toString()); buffer.writeString(chatData.sender.toString());
buffer.writeInt(playerData.friendship); 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); ServerPlayNetworking.send(player, PACKET_S2C_MESSAGE, buffer);
} }
break; 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