diff --git a/pom.xml b/pom.xml
index e9040f6..a50394d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
com.github.ucchyocean
LunaChat
- 2.6.8
+ 2.6.9
チャンネルチャットプラグイン
diff --git a/src/main/java/com/github/ucchyocean/lc/channel/DelayedJapanizeConvertTask.java b/src/main/java/com/github/ucchyocean/lc/channel/DelayedJapanizeConvertTask.java
index 59c18a4..2cf4fdd 100644
--- a/src/main/java/com/github/ucchyocean/lc/channel/DelayedJapanizeConvertTask.java
+++ b/src/main/java/com/github/ucchyocean/lc/channel/DelayedJapanizeConvertTask.java
@@ -108,7 +108,7 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
for ( String keyword : keywords ) {
if ( keywordLocked.contains(keyword) ) {
index++;
- String key = "<" + index + ">";
+ String key = "<" + makeMultibytesDigit(index) + ">";
keywordLocked = keywordLocked.replace(keyword, key);
keywordMap.put(key, keyword);
}
@@ -116,7 +116,7 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
for ( String dickey : dictionary.keySet() ) {
if ( keywordLocked.contains(dickey) ) {
index++;
- String key = "<" + index + ">";
+ String key = "<" + makeMultibytesDigit(index) + ">";
keywordLocked = keywordLocked.replace(dickey, key);
keywordMap.put(key, dictionary.get(dickey));
}
@@ -125,11 +125,6 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
// カナ変換
String japanized = KanaConverter.conv(keywordLocked);
- // キーワードのアンロック
- for ( String key : keywordMap.keySet() ) {
- japanized = japanized.replace(key, keywordMap.get(key));
- }
-
// IME変換
if ( type == JapanizeType.GOOGLE_IME ) {
japanized = IMEConverter.convByGoogleIME(japanized);
@@ -137,6 +132,11 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
japanized = IMEConverter.convBySocialIME(japanized);
}
+ // キーワードのアンロック
+ for ( String key : keywordMap.keySet() ) {
+ japanized = japanized.replace(key, keywordMap.get(key));
+ }
+
// 変換後の文字列にNGワードが含まれている場合は、マスクする
for ( Pattern pattern :
LunaChat.getInstance().getLunaChatConfig().getNgwordCompiled() ) {
@@ -171,5 +171,31 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
public String getResult() {
return result;
}
+
+ /**
+ * 数値を、全角文字の文字列に変換して返す
+ * @param digit
+ * @return
+ */
+ private String makeMultibytesDigit(int digit) {
+
+ String half = Integer.toString(digit);
+ StringBuilder result = new StringBuilder();
+ for ( int index=0; index < half.length(); index++ ) {
+ switch ( half.charAt(index) ) {
+ case '0' : result.append("0"); break;
+ case '1' : result.append("1"); break;
+ case '2' : result.append("2"); break;
+ case '3' : result.append("3"); break;
+ case '4' : result.append("4"); break;
+ case '5' : result.append("5"); break;
+ case '6' : result.append("6"); break;
+ case '7' : result.append("7"); break;
+ case '8' : result.append("8"); break;
+ case '9' : result.append("9"); break;
+ }
+ }
+ return result.toString();
+ }
}