LunaChat v2.6.7 : Fixed bugs about issue #100
このコミットが含まれているのは:
1 親
24c5de4e7c
コミット
b1b91a0864
4ファイル変更
+27
-17
検索条件に一致するファイルはありません
@@ -202,6 +202,7 @@ public class PlayerListener implements Listener {
|
||||
message = Utility.replaceColorCode(message);
|
||||
}
|
||||
|
||||
|
||||
// 一時的にJapanizeスキップ設定かどうかを確認する
|
||||
boolean skipJapanize = false;
|
||||
String marker = config.getNoneJapanizeMarker();
|
||||
@@ -211,9 +212,10 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
// 2byteコードを含むなら、Japanize変換は行わない
|
||||
String kanaTemp = Utility.stripColor(message);
|
||||
if ( !skipJapanize &&
|
||||
( message.getBytes().length > message.length() ||
|
||||
message.matches("[ \\uFF61-\\uFF9F]+") ) ) {
|
||||
( kanaTemp.getBytes().length > kanaTemp.length() ||
|
||||
kanaTemp.matches("[ \\uFF61-\\uFF9F]+") ) ) {
|
||||
skipJapanize = true;
|
||||
}
|
||||
|
||||
@@ -223,22 +225,21 @@ public class PlayerListener implements Listener {
|
||||
config.getJapanizeType() != JapanizeType.NONE ) {
|
||||
|
||||
int lineType = config.getJapanizeDisplayLine();
|
||||
String taskFormat;
|
||||
|
||||
if ( lineType == 1 ) {
|
||||
|
||||
taskFormat = config.getJapanizeLine1Format();
|
||||
String taskFormat = Utility.replaceColorCode(config.getJapanizeLine1Format());
|
||||
|
||||
String japanized = api.japanize(
|
||||
message, config.getJapanizeType());
|
||||
kanaTemp, config.getJapanizeType());
|
||||
if ( japanized != null ) {
|
||||
String temp = taskFormat.replace("%msg", message);
|
||||
temp = temp.replace("%japanize", japanized);
|
||||
message = Utility.replaceColorCode(temp);
|
||||
message = temp.replace("%japanize", japanized);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
taskFormat = config.getJapanizeLine2Format();
|
||||
String taskFormat = Utility.replaceColorCode(config.getJapanizeLine2Format());
|
||||
|
||||
DelayedJapanizeConvertTask task = new DelayedJapanizeConvertTask(message,
|
||||
config.getJapanizeType(), null, player, taskFormat, null);
|
||||
|
||||
@@ -114,12 +114,21 @@ public class Utility {
|
||||
}
|
||||
|
||||
/**
|
||||
* 文字列内のカラーコードを置き換えする
|
||||
* 文字列内のカラーコード候補(&a)を、カラーコード(§a)に置き換えする
|
||||
* @param source 置き換え元の文字列
|
||||
* @return 置き換え後の文字列
|
||||
*/
|
||||
public static String replaceColorCode(String source) {
|
||||
return source.replaceAll("&([0-9a-fk-or])", "\u00A7$1");
|
||||
return ChatColor.translateAlternateColorCodes('&', source);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文字列に含まれているカラーコード(§a)を除去して返す
|
||||
* @param source 置き換え元の文字列
|
||||
* @return 置き換え後の文字列
|
||||
*/
|
||||
public static String stripColor(String source) {
|
||||
return ChatColor.stripColor(source);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -135,9 +135,10 @@ public class ChannelImpl extends Channel {
|
||||
maskedMessage = event.getNgMaskedMessage();
|
||||
|
||||
// 2byteコードを含むか、半角カタカナのみなら、Japanize変換は行わない
|
||||
String kanaTemp = Utility.stripColor(maskedMessage);
|
||||
if ( !skipJapanize &&
|
||||
( message.getBytes().length > message.length() ||
|
||||
message.matches("[ \\uFF61-\\uFF9F]+") ) ) {
|
||||
( kanaTemp.getBytes().length > kanaTemp.length() ||
|
||||
kanaTemp.matches("[ \\uFF61-\\uFF9F]+") ) ) {
|
||||
skipJapanize = true;
|
||||
}
|
||||
|
||||
@@ -153,11 +154,11 @@ public class ChannelImpl extends Channel {
|
||||
String jpFormat;
|
||||
String messageFormat = null;
|
||||
if ( lineType == 1 ) {
|
||||
jpFormat = config.getJapanizeLine1Format();
|
||||
jpFormat = Utility.replaceColorCode(config.getJapanizeLine1Format());
|
||||
messageFormat = msgFormat;
|
||||
isIncludeSyncChat = false;
|
||||
} else {
|
||||
jpFormat = config.getJapanizeLine2Format();
|
||||
jpFormat = Utility.replaceColorCode(config.getJapanizeLine2Format());
|
||||
}
|
||||
|
||||
// タスクを作成しておく
|
||||
|
||||
@@ -95,8 +95,8 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
|
||||
}
|
||||
}
|
||||
|
||||
// URL削除
|
||||
String deletedURL = org.replaceAll(REGEX_URL, " ");
|
||||
// カラーコード削除、URL削除
|
||||
String deletedURL = Utility.stripColor(org.replaceAll(REGEX_URL, " "));
|
||||
|
||||
// キーワードをロック
|
||||
int index = 0;
|
||||
@@ -146,7 +146,6 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
|
||||
// フォーマットする
|
||||
result = format.replace("%msg", org);
|
||||
result = result.replace("%japanize", japanized);
|
||||
result = Utility.replaceColorCode(result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする