LunaChat v2.7.7 : Fixed issue #137

このコミットが含まれているのは:
ucchy committed 2015-12-27 18:00:31 +09:00
1 親 42a9625595
コミット d3fa98509d
3ファイル変更
+40

検索条件に一致するファイルはありません

+20
ファイルの表示
@@ -5,7 +5,9 @@
*/
package com.github.ucchyocean.lc;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -39,6 +41,17 @@ public class PlayerListener implements Listener {
private static final String LIST_ENDLINE = Resources.get("listEndLine");
private static final String LIST_FORMAT = Resources.get("listFormat");
private SimpleDateFormat dateFormat;
private SimpleDateFormat timeFormat;
/**
* コンストラクタ
*/
public PlayerListener() {
dateFormat = new SimpleDateFormat("yyyy/MM/dd");
timeFormat = new SimpleDateFormat("HH:mm:ss");
}
/**
* プレイヤーのチャットごとに呼び出されるメソッド
* @param event チャットイベント
@@ -374,6 +387,13 @@ public class PlayerListener implements Listener {
format = format.replace("%username", "%1$s");
format = format.replace("%msg", "%2$s");
if ( format.contains("%date") ) {
format = format.replace("%date", dateFormat.format(new Date()));
}
if ( format.contains("%time") ) {
format = format.replace("%time", timeFormat.format(new Date()));
}
if ( format.contains("%prefix") || format.contains("%suffix") ) {
String prefix = "";
+14
ファイルの表示
@@ -5,7 +5,9 @@
*/
package com.github.ucchyocean.lc.channel;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -67,6 +69,9 @@ public class ChannelImpl extends Channel {
private static final String ERRMSG_MUTED = Resources.get("errmsgMuted");
private SimpleDateFormat dateFormat;
private SimpleDateFormat timeFormat;
/** ロガー */
private LunaChatLogger logger;
@@ -79,6 +84,8 @@ public class ChannelImpl extends Channel {
super(name);
logger = new LunaChatLogger(name.replace(">", "-"));
dateFormat = new SimpleDateFormat("yyyy/MM/dd");
timeFormat = new SimpleDateFormat("HH:mm:ss");
}
/**
@@ -680,6 +687,13 @@ public class ChannelImpl extends Channel {
msg = msg.replace("%color", getColorCode());
msg = msg.replace("%to", getPrivateMessageTo());
if ( msg.contains("%date") ) {
msg = msg.replace("%date", dateFormat.format(new Date()));
}
if ( msg.contains("%time") ) {
msg = msg.replace("%time", timeFormat.format(new Date()));
}
if ( player != null ) {
msg = msg.replace("%username", player.getDisplayName());
msg = msg.replace("%player", player.getName());