Improved stability and other related fixes:

* server: added limit to max chat message (related to #11285);
* gui: fixed possible error after auto-submit deck;
* gui: fixed possible error after end game dialog;
* refactor: other code improves;
This commit is contained in:
Oleg Agafonov 2023-11-25 12:29:54 +04:00
parent 81f97c3b0e
commit d1f9e9cc90
15 changed files with 86 additions and 48 deletions

View file

@ -5,6 +5,7 @@ import mage.client.SessionHandler;
import mage.client.cards.BigCard;
import mage.client.dialog.PreferencesDialog;
import mage.client.util.GUISizeHelper;
import mage.constants.Constants;
import mage.view.ChatMessage.MessageColor;
import mage.view.ChatMessage.MessageType;
import org.mage.card.arcane.ManaSymbols;
@ -103,7 +104,6 @@ public class ChatPanelBasic extends javax.swing.JPanel {
jScrollPaneTxt.getViewport().setBackground(new Color(0, 0, 0, CHAT_ALPHA));
jScrollPaneTxt.setViewportBorder(null);
}
}
public void cleanUp() {
@ -398,6 +398,12 @@ public class ChatPanelBasic extends javax.swing.JPanel {
public void handleKeyTyped(java.awt.event.KeyEvent evt) {
if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
if (this.txtMessage.getText().length() > Constants.MAX_CHAT_MESSAGE_SIZE) {
JOptionPane.showMessageDialog(null, "Can't send too long message", "Chat", JOptionPane.WARNING_MESSAGE);
return;
}
if (parentChatRef != null) {
SessionHandler.sendChatMessage(parentChatRef.chatId, this.txtMessage.getText());
} else {