From 1ed874b6fd9ed2ccf8c62259a09a352b926ae800 Mon Sep 17 00:00:00 2001 From: ucchy Date: Sun, 28 Sep 2014 13:30:19 +0900 Subject: [PATCH] LunaChat v2.6.8 : Fixed issue #105 --- .../com/github/ucchyocean/lc/LunaChatConfig.java | 13 +++++++++++++ .../github/ucchyocean/lc/channel/ChannelImpl.java | 13 +++++++++++++ src/main/resources/config_ja.yml | 3 +++ src/main/resources/plugin.yml | 4 ++++ 4 files changed, 33 insertions(+) diff --git a/src/main/java/com/github/ucchyocean/lc/LunaChatConfig.java b/src/main/java/com/github/ucchyocean/lc/LunaChatConfig.java index 685a4cc..b86c2b9 100644 --- a/src/main/java/com/github/ucchyocean/lc/LunaChatConfig.java +++ b/src/main/java/com/github/ucchyocean/lc/LunaChatConfig.java @@ -61,6 +61,9 @@ public class LunaChatConfig { /** プライベートメッセージを送信するときに、適用されるフォーマット */ private String defaultFormatForPrivateMessage; + /** OPの画面に、全チャンネルの発言内容を表示するかどうか */ + private boolean opListenAllChannel; + /** ブロードキャストチャンネルの発言内容を、dynmapに送信するかどうか。
* dynmapがロードされていない場合は、この設定は無視される(false扱い)。 */ private boolean sendBroadcastChannelChatToDynmap; @@ -179,6 +182,8 @@ public class LunaChatConfig { config.getString("defaultFormatForPrivateMessage", "&7[%player > %to] %msg"); + opListenAllChannel = config.getBoolean("opListenAllChannel", false); + sendBroadcastChannelChatToDynmap = config.getBoolean("sendBroadcastChannelChatToDynmap", true); sendFormattedMessageToDynmap = @@ -321,6 +326,14 @@ public class LunaChatConfig { return defaultFormatForPrivateMessage; } + /** + * OPの画面に、全チャンネルの発言内容を表示するかどうか + * @return opListenAllChannel opListenAllChannelを返す + */ + public boolean isOpListenAllChannel() { + return opListenAllChannel; + } + /** * NGワード * @return ngwordを返す diff --git a/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java b/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java index 098a09c..e752c85 100644 --- a/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java +++ b/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java @@ -351,6 +351,19 @@ public class ChannelImpl extends Channel { } } + // opListenAllChannel 設定がある場合は、 + // パーミッション lunachat-admin.listen-all-channels を持つプレイヤーを + // 受信者に加える。 + if ( config.isOpListenAllChannel() ) { + for ( Player p : Bukkit.getOnlinePlayers() ) { + ChannelPlayer cp = ChannelPlayer.getChannelPlayer(p); + if ( cp.hasPermission("lunachat-admin.listen-all-channels") + && !recipients.contains(cp) ) { + recipients.add(cp); + } + } + } + // フォーマットがある場合は置き換える if ( format != null ) { message = format.replace("%msg", message); diff --git a/src/main/resources/config_ja.yml b/src/main/resources/config_ja.yml index e506f7f..afdbabb 100644 --- a/src/main/resources/config_ja.yml +++ b/src/main/resources/config_ja.yml @@ -58,6 +58,9 @@ formatConstraint: ['%username', '%msg'] # %msg : 発言内容(Japanize変換された場合は、Japanize結果を含みます。) defaultFormat: '&f[%color%ch&f]%prefix%username%suffix&a:&f %msg' +# OPの画面に、全チャンネルの発言内容を表示する設定。 +opListenAllChannel: false + # -------------------- プライベートメッセージ設定 -------------------- diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 2369439..8a54ed8 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -199,6 +199,9 @@ permissions: lunachat-admin.mod-all-channels: description: 全チャンネルのモデレータ権限 default: op + lunachat-admin.listen-all-channels: + description: 全チャンネルのチャット表示権限 + default: op lunachat-admin.template: description: templateコマンドの使用権限 default: op @@ -217,6 +220,7 @@ permissions: lunachat-admin.*: children: lunachat-admin.mod-all-channels: true + lunachat-admin.listen-all-channels: true lunachat-admin.template: true lunachat-admin.dictionary: true lunachat-admin.check: true