mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Support triangles for chat
This commit is contained in:
44
forge-gui/src/main/java/forge/net/ChatMessage.java
Normal file
44
forge-gui/src/main/java/forge/net/ChatMessage.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package forge.net;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
|
||||
public class ChatMessage {
|
||||
private static final ForgePreferences prefs = FModel.getPreferences();
|
||||
private static final SimpleDateFormat inFormat = new SimpleDateFormat("HH:mm:ss");
|
||||
|
||||
private final String source, message, timestamp;
|
||||
|
||||
public ChatMessage(String source0, String message0) {
|
||||
source = source0;
|
||||
message = message0;
|
||||
timestamp = inFormat.format(new Date());
|
||||
}
|
||||
|
||||
public boolean isLocal() {
|
||||
return source == null || source.equals(prefs.getPref(FPref.PLAYER_NAME));
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public String getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public String getFormattedMessage() {
|
||||
if (source == null) {
|
||||
return String.format("%n[%s] %s", timestamp, message);
|
||||
}
|
||||
return String.format("%n[%s] %s: %s", timestamp, source, message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user