LunaChat v2.6.7 : Fixed issue #100

このコミットが含まれているのは:
ucchy committed 2014-09-01 12:39:21 +09:00
1 親 6128131b11
コミット 23559dfebf
13ファイル変更
+157 -7

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

+13
ファイルの表示
@@ -86,6 +86,9 @@ public class LunaChatConfig {
/** 通常チャットの装飾フォーマット */
private String normalChatMessageFormat;
/** 通常チャットで、カラーコードを使用可能にするかどうか */
private boolean enableNormalChatColorCode;
/** Japanize変換のタイプ<br/>
* none = 日本語変換をしない<br/>
* kana = カナ変換のみする<br/>
@@ -188,6 +191,8 @@ public class LunaChatConfig {
config.getBoolean("enableNormalChatMessageFormat", true);
normalChatMessageFormat =
config.getString("normalChatMessageFormat", "&f<%prefix%username%suffix&f> %msg");
enableNormalChatColorCode =
config.getBoolean("enableNormalChatColorCode", true);
japanizeType = JapanizeType.fromID(config.getString("japanizeType", "kana"));
japanizeDisplayLine = config.getInt("japanizeDisplayLine", 2);
@@ -437,4 +442,12 @@ public class LunaChatConfig {
public int getJapanizeWait() {
return japanizeWait;
}
/**
* 通常チャットで、カラーコードを使用可能にするかどうか
* @return enableNormalChatColorCodeを返す
*/
public boolean isEnableNormalChatColorCode() {
return enableNormalChatColorCode;
}
}
+5 -1
ファイルの表示
@@ -197,7 +197,11 @@ public class PlayerListener implements Listener {
}
// カラーコード置き換え
message = Utility.replaceColorCode(message);
// 置き換え設定になっていて、発言者がパーミッションを持っているなら、置き換えする
if ( config.isEnableNormalChatColorCode() &&
event.getPlayer().hasPermission("lunachat.allowcc") ) {
message = Utility.replaceColorCode(message);
}
// 一時的にJapanizeスキップ設定かどうかを確認する
boolean skipJapanize = false;
+23
ファイルの表示
@@ -51,6 +51,7 @@ public abstract class Channel implements ConfigurationSerializable {
private static final String KEY_RANGE = "range";
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 List<ChannelPlayer> members;
@@ -111,6 +112,9 @@ public abstract class Channel implements ConfigurationSerializable {
/** 1:1チャットの相手名 */
private String privateMessageTo;
/** カラーコードの使用可否 */
private boolean allowcc;
/**
* コンストラクタ
* @param name チャンネルの名称
@@ -133,6 +137,7 @@ public abstract class Channel implements ConfigurationSerializable {
this.banExpires = new HashMap<ChannelPlayer, Long>();
this.muteExpires = new HashMap<ChannelPlayer, Long>();
this.privateMessageTo = "";
this.allowcc = true;
LunaChatConfig config = LunaChat.getInstance().getLunaChatConfig();
if ( isPersonalChat() ) {
@@ -424,6 +429,7 @@ public abstract class Channel implements ConfigurationSerializable {
map.put(KEY_RANGE, chatRange);
map.put(KEY_BAN_EXPIRES, getStringLongMap(banExpires));
map.put(KEY_MUTE_EXPIRES, getStringLongMap(muteExpires));
map.put(KEY_ALLOWCC, allowcc);
return map;
}
@@ -456,6 +462,7 @@ public abstract class Channel implements ConfigurationSerializable {
channel.chatRange = castWithDefault(data.get(KEY_RANGE), 0);
channel.banExpires = castToChannelPlayerLongMap(data.get(KEY_BAN_EXPIRES));
channel.muteExpires = castToChannelPlayerLongMap(data.get(KEY_MUTE_EXPIRES));
channel.allowcc = castWithDefault(data.get(KEY_ALLOWCC), true);
return channel;
}
@@ -806,6 +813,22 @@ public abstract class Channel implements ConfigurationSerializable {
return chatRange;
}
/**
* カラーコードが使用可能な設定かどうか
* @return allowccを返す
*/
public boolean isAllowCC() {
return allowcc;
}
/**
* カラーコードの使用可否を設定する
* @param allowcc 使用可否
*/
public void setAllowCC(boolean allowcc) {
this.allowcc = allowcc;
}
/**
* チャンネルの情報をファイルに保存する。
* @return 保存をしたかどうか。
+8 -3
ファイルの表示
@@ -118,7 +118,10 @@ public class ChannelImpl extends Channel {
String msgFormat = replaceKeywords(getFormat(), player);
// カラーコード置き換え
maskedMessage = Utility.replaceColorCode(maskedMessage);
// チャンネルで許可されていて、発言者がパーミッションを持っている場合に置き換える
if ( isAllowCC() && player.hasPermission("lunachat.allowcc") ) {
maskedMessage = Utility.replaceColorCode(maskedMessage);
}
// イベントコール
LunaChatChannelChatEvent event =
@@ -245,8 +248,10 @@ public class ChannelImpl extends Channel {
msgFormat = msgFormat.replace("%prefix", "");
msgFormat = msgFormat.replace("%suffix", "");
// カラーコード置き換え
maskedMessage = Utility.replaceColorCode(maskedMessage);
// カラーコード置き換え チャンネルで許可されている場合に置き換える。
if ( isAllowCC() ) {
maskedMessage = Utility.replaceColorCode(maskedMessage);
}
// メッセージの送信
sendMessage(null, maskedMessage, msgFormat, false);
+7
ファイルの表示
@@ -66,6 +66,13 @@ public abstract class ChannelPlayer implements Comparable<ChannelPlayer> {
*/
public abstract String getWorldName();
/**
* 指定されたパーミッションノードの権限を持っているかどうかを取得する
* @param node パーミッションノード
* @return 権限を持っているかどうか
*/
public abstract boolean hasPermission(String node);
/**
* 指定されたCommandSenderと同一かどうかを返す
* @param sender
+11
ファイルの表示
@@ -105,6 +105,17 @@ public class ChannelPlayerBlock extends ChannelPlayer {
return "-";
}
/**
* 指定されたパーミッションノードの権限を持っているかどうかを取得する
* @param node パーミッションノード
* @return 権限を持っているかどうか
* @see com.github.ucchyocean.lc.channel.ChannelPlayer#hasPermission(java.lang.String)
*/
@Override
public boolean hasPermission(String node) {
return sender.hasPermission(node);
}
/**
* 指定されたCommandSenderと同一かどうかを返す
* @param sender
+11
ファイルの表示
@@ -105,6 +105,17 @@ public class ChannelPlayerConsole extends ChannelPlayer {
return "-";
}
/**
* 指定されたパーミッションノードの権限を持っているかどうかを取得する
* @param node パーミッションノード
* @return 権限を持っているかどうか
* @see com.github.ucchyocean.lc.channel.ChannelPlayer#hasPermission(java.lang.String)
*/
@Override
public boolean hasPermission(String node) {
return sender.hasPermission(node);
}
/**
* 指定されたCommandSenderと同一かどうかを返す
* @param sender
+16
ファイルの表示
@@ -136,6 +136,22 @@ public class ChannelPlayerName extends ChannelPlayer {
return "-";
}
/**
* 指定されたパーミッションノードの権限を持っているかどうかを取得する
* @param node パーミッションノード
* @return 権限を持っているかどうか
* @see com.github.ucchyocean.lc.channel.ChannelPlayer#hasPermission(java.lang.String)
*/
@Override
public boolean hasPermission(String node) {
Player player = getPlayer();
if ( player == null ) {
return false;
} else {
return player.hasPermission(node);
}
}
/**
* 指定されたCommandSenderと同一かどうかを返す
* @param sender
+16
ファイルの表示
@@ -186,6 +186,22 @@ public class ChannelPlayerUUID extends ChannelPlayer {
return "-";
}
/**
* 指定されたパーミッションノードの権限を持っているかどうかを取得する
* @param node パーミッションノード
* @return 権限を持っているかどうか
* @see com.github.ucchyocean.lc.channel.ChannelPlayer#hasPermission(java.lang.String)
*/
@Override
public boolean hasPermission(String node) {
Player player = getPlayer();
if ( player == null ) {
return false;
} else {
return player.hasPermission(node);
}
}
/**
* 指定されたCommandSenderと同一かどうかを返す
* @param sender
+28
ファイルの表示
@@ -262,6 +262,34 @@ public class OptionCommand extends SubCommandAbst {
}
}
if ( options.containsKey("allowcc") ) {
// カラーコード使用可否
String pnode = PERMISSION_NODE + ".allowcc";
if ( !sender.hasPermission(pnode) ) {
sendResourceMessage(sender, PREERR,
"errmsgNotPermission", pnode);
} else {
String value = options.get("allowcc");
if ( value.equals("") || value.equalsIgnoreCase("false") ) {
channel.setAllowCC(false);
sendResourceMessage(sender, PREINFO,
"cmdmsgOption", "allowcc", "false");
setOption = true;
} else if ( value.equalsIgnoreCase("true") ) {
channel.setAllowCC(true);
sendResourceMessage(sender, PREINFO,
"cmdmsgOption", "allowcc", "true");
setOption = true;
} else {
sendResourceMessage(sender, PREERR,
"errmsgInvalidBooleanOption", "allowcc");
}
}
}
if ( !channel.isGlobalChannel() ) {
if ( options.containsKey("password") ) {