IbanEtchep / BungeeChatKeeper

2 stars 1 forks source link

Server Switch double Messages #2

Closed backtothebeck closed 1 week ago

backtothebeck commented 3 months ago

If I change servers, e.g. lobby-1 to lobby-2, I see all the messages that I previously had in the chat.

If I now switch back, I have the chat from lobby-1 as well as lobby-2.

e.g. lobby-1: "X joined the Game" "Hello"

e.g. lobby-2: "X joined the Game" "Hello" "Hi"

back to lobby-1: "X joined the Game" "Hello" "X joined the Game" "Hello" "Hi"

Can you fix this? Thank you!

backtothebeck commented 3 months ago

I fixed the problem by adding the following code to the ServerSwitchEvent after the messages were sent:

plugin.getChatHistory().remove(player.getUniqueId());

IbanEtchep commented 3 months ago

Yeah, but it shouldn't be noticeable once there are enough messages in the player's chat history. And if you clear the history on each server switch, the players will lose their chat history if they switch servers multiple times in a short amount of time :/