LunaChat v2.7.1 : Fixed issue #125
このコミットが含まれているのは:
1 親
d647fadd17
コミット
b99d447d81
7ファイル変更
+71
-7
検索条件に一致するファイルはありません
@@ -217,7 +217,7 @@ public class LunaChatConfig {
|
||||
enableNormalChatColorCode =
|
||||
config.getBoolean("enableNormalChatColorCode", true);
|
||||
|
||||
japanizeType = JapanizeType.fromID(config.getString("japanizeType", "kana"));
|
||||
japanizeType = JapanizeType.fromID(config.getString("japanizeType"), JapanizeType.KANA);
|
||||
japanizeDisplayLine = config.getInt("japanizeDisplayLine", 2);
|
||||
if ( japanizeDisplayLine != 1 && japanizeDisplayLine != 2 ) {
|
||||
japanizeDisplayLine = 2;
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.github.ucchyocean.lc.LunaChatAPI;
|
||||
import com.github.ucchyocean.lc.LunaChatConfig;
|
||||
import com.github.ucchyocean.lc.Utility;
|
||||
import com.github.ucchyocean.lc.event.LunaChatChannelMemberChangedEvent;
|
||||
import com.github.ucchyocean.lc.japanize.JapanizeType;
|
||||
|
||||
/**
|
||||
* チャンネル
|
||||
@@ -53,6 +54,7 @@ public abstract class Channel implements ConfigurationSerializable {
|
||||
private static final String KEY_BAN_EXPIRES = "ban_expires";
|
||||
private static final String KEY_MUTE_EXPIRES = "mute_expires";
|
||||
private static final String KEY_ALLOWCC = "allowcc";
|
||||
private static final String KEY_JAPANIZE = "japanize";
|
||||
|
||||
/** 参加者 */
|
||||
private List<ChannelPlayer> members;
|
||||
@@ -119,6 +121,9 @@ public abstract class Channel implements ConfigurationSerializable {
|
||||
/** カラーコードの使用可否 */
|
||||
private boolean allowcc;
|
||||
|
||||
/** チャンネルごとのjapanize変換設定 */
|
||||
private JapanizeType japanizeType;
|
||||
|
||||
/**
|
||||
* コンストラクタ
|
||||
* @param name チャンネルの名称
|
||||
@@ -143,6 +148,7 @@ public abstract class Channel implements ConfigurationSerializable {
|
||||
this.muteExpires = new HashMap<ChannelPlayer, Long>();
|
||||
this.privateMessageTo = "";
|
||||
this.allowcc = true;
|
||||
this.japanizeType = null;
|
||||
|
||||
LunaChatConfig config = LunaChat.getInstance().getLunaChatConfig();
|
||||
if ( isPersonalChat() ) {
|
||||
@@ -447,6 +453,7 @@ public abstract class Channel implements ConfigurationSerializable {
|
||||
map.put(KEY_BAN_EXPIRES, getStringLongMap(banExpires));
|
||||
map.put(KEY_MUTE_EXPIRES, getStringLongMap(muteExpires));
|
||||
map.put(KEY_ALLOWCC, allowcc);
|
||||
map.put(KEY_JAPANIZE, japanizeType == null ? null : japanizeType.toString());
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -481,6 +488,7 @@ public abstract class Channel implements ConfigurationSerializable {
|
||||
channel.banExpires = castToChannelPlayerLongMap(data.get(KEY_BAN_EXPIRES));
|
||||
channel.muteExpires = castToChannelPlayerLongMap(data.get(KEY_MUTE_EXPIRES));
|
||||
channel.allowcc = castWithDefault(data.get(KEY_ALLOWCC), true);
|
||||
channel.japanizeType = JapanizeType.fromID(data.get(KEY_JAPANIZE) + "", null);
|
||||
return channel;
|
||||
}
|
||||
|
||||
@@ -863,6 +871,22 @@ public abstract class Channel implements ConfigurationSerializable {
|
||||
this.allowcc = allowcc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Japanize変換設定を取得する
|
||||
* @return japanize
|
||||
*/
|
||||
public JapanizeType getJapanizeType() {
|
||||
return japanizeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Japanize変換設定を再設定する
|
||||
* @param japanize japanize
|
||||
*/
|
||||
public void setJapanizeType(JapanizeType japanize) {
|
||||
this.japanizeType = japanize;
|
||||
}
|
||||
|
||||
/**
|
||||
* チャンネルの情報をファイルに保存する。
|
||||
* @return 保存をしたかどうか。
|
||||
|
||||
@@ -159,10 +159,12 @@ public class ChannelImpl extends Channel {
|
||||
// Japanize変換タスクを作成する
|
||||
boolean isIncludeSyncChat = true;
|
||||
DelayedJapanizeConvertTask delayedTask = null;
|
||||
JapanizeType japanizeType = (getJapanizeType() == null)
|
||||
? config.getJapanizeType() : getJapanizeType();
|
||||
|
||||
if ( !skipJapanize &&
|
||||
api.isPlayerJapanize(player.getName()) &&
|
||||
config.getJapanizeType() != JapanizeType.NONE ) {
|
||||
japanizeType != JapanizeType.NONE ) {
|
||||
|
||||
int lineType = config.getJapanizeDisplayLine();
|
||||
String jpFormat;
|
||||
@@ -177,8 +179,7 @@ public class ChannelImpl extends Channel {
|
||||
|
||||
// タスクを作成しておく
|
||||
delayedTask = new DelayedJapanizeConvertTask(maskedMessage,
|
||||
config.getJapanizeType(),
|
||||
this, player, jpFormat, messageFormat);
|
||||
japanizeType, this, player, jpFormat, messageFormat);
|
||||
}
|
||||
|
||||
if ( isIncludeSyncChat ) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.bukkit.entity.Player;
|
||||
import com.github.ucchyocean.lc.Utility;
|
||||
import com.github.ucchyocean.lc.channel.Channel;
|
||||
import com.github.ucchyocean.lc.event.LunaChatChannelOptionChangedEvent;
|
||||
import com.github.ucchyocean.lc.japanize.JapanizeType;
|
||||
|
||||
/**
|
||||
* optionコマンドの実行クラス
|
||||
@@ -324,6 +325,37 @@ public class OptionCommand extends SubCommandAbst {
|
||||
}
|
||||
}
|
||||
|
||||
if ( options.containsKey("japanize") ) {
|
||||
// Japanize変換設定
|
||||
|
||||
String pnode = PERMISSION_NODE + ".japanize";
|
||||
if ( !sender.hasPermission(pnode) ) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgNotPermission", pnode);
|
||||
} else {
|
||||
|
||||
String value = options.get("japanize");
|
||||
|
||||
if ( value.equals("") ) {
|
||||
channel.setJapanizeType(null);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "japanize", "デフォルト");
|
||||
setOption = true;
|
||||
} else {
|
||||
JapanizeType type = JapanizeType.fromID(value, null);
|
||||
if ( type == null ) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgInvalidJapanizeOption", "japanize", value);
|
||||
} else {
|
||||
channel.setJapanizeType(type);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "japanize", type.toString());
|
||||
setOption = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !channel.isGlobalChannel() ) {
|
||||
|
||||
if ( options.containsKey("password") ) {
|
||||
|
||||
@@ -38,15 +38,17 @@ public enum JapanizeType {
|
||||
|
||||
/**
|
||||
* 文字列表記からJapanizeTypeを作成して返す
|
||||
* @param id
|
||||
* @param id ID
|
||||
* @param def デフォルト
|
||||
* @return
|
||||
*/
|
||||
public static JapanizeType fromID(String id) {
|
||||
public static JapanizeType fromID(String id, JapanizeType def) {
|
||||
if ( id == null ) return def;
|
||||
for ( JapanizeType type : values() ) {
|
||||
if ( type.id.equalsIgnoreCase(id) ) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return NONE;
|
||||
return def;
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする