Fixed local server time in client's chat messages

This commit is contained in:
rsypen 2018-01-15 09:17:35 +01:00 committed by GitHub
parent bc3274b144
commit ccd121277a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 17 deletions

View file

@ -37,6 +37,8 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.KeyEvent;
import java.text.DateFormat;
import java.util.Date;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -55,6 +57,11 @@ import org.mage.card.arcane.ManaSymbols;
*/
public class ChatPanelBasic extends javax.swing.JPanel {
/**
* Time formatter
*/
protected final DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT);
protected UUID chatId;
/**
* Chat message color for opponents.
@ -238,10 +245,10 @@ public class ChatPanelBasic extends javax.swing.JPanel {
*/
Pattern cardNamePattern = Pattern.compile(".*<font bgcolor=orange.*?</font>.*");
public void receiveMessage(String username, String message, String time, MessageType messageType, MessageColor color) {
public void receiveMessage(String username, String message, Date time, MessageType messageType, MessageColor color) {
StringBuilder text = new StringBuilder();
if (time != null) {
text.append(getColoredText(TIMESTAMP_COLOR, time + ": "));
text.append(getColoredText(TIMESTAMP_COLOR, timeFormatter.format(time) + ": "));
//this.txtConversation.append(TIMESTAMP_COLOR, time + " ");
}
String userColor;