Disallow joining same chatroom

This commit is contained in:
Minecon724 2024-12-05 19:59:31 +01:00
parent 760f52df71
commit 6183ccd6bf
Signed by untrusted user who does not match committer: Minecon724
GPG key ID: 3CCC4D267742C8E8
3 changed files with 10 additions and 0 deletions

View file

@ -86,6 +86,9 @@ public class ChatManager {
*/
public void setPlayerChatRoom(ChatRoom chatRoom, Player player) {
ChatRoom oldRoom = getPlayerChatRoom(player);
if (chatRoom.equals(oldRoom)) return; // no change if changing to the same room
oldRoom.players.remove(player);
player.getPersistentDataContainer().set(chatRoomKey, PersistentDataType.STRING, chatRoom.id);