diff --git a/pom.xml b/pom.xml
index a7020ae..60d1aef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
com.github.ucchyocean
LunaChat
- 2.8.4
+ 2.8.5
チャンネルチャットプラグイン
@@ -116,6 +116,11 @@
MD5 repository
http://repo.md-5.net/content/repositories/releases
+
+ dhmc-rep
+ Prism repository
+ http://dhmc.us:8081/nexus/content/repositories/releases/
+
@@ -151,5 +156,10 @@
mcMMO
1.5.00
+
+ me.botsko
+ prism
+ 2.0.6
+
\ No newline at end of file
diff --git a/src/main/java/com/github/ucchyocean/lc/LunaChat.java b/src/main/java/com/github/ucchyocean/lc/LunaChat.java
index 05475c0..f207fa5 100644
--- a/src/main/java/com/github/ucchyocean/lc/LunaChat.java
+++ b/src/main/java/com/github/ucchyocean/lc/LunaChat.java
@@ -18,6 +18,7 @@ import com.github.ucchyocean.lc.bridge.DynmapBridge;
import com.github.ucchyocean.lc.bridge.HawkEyeBridge;
import com.github.ucchyocean.lc.bridge.McMMOBridge;
import com.github.ucchyocean.lc.bridge.MultiverseCoreBridge;
+import com.github.ucchyocean.lc.bridge.PrismBridge;
import com.github.ucchyocean.lc.bridge.VaultChatBridge;
import com.github.ucchyocean.lc.channel.ChannelManager;
import com.github.ucchyocean.lc.command.LunaChatCommand;
@@ -40,6 +41,7 @@ public class LunaChat extends JavaPlugin {
private DynmapBridge dynmap;
private HawkEyeBridge hawkeye;
private MultiverseCoreBridge multiverse;
+ private PrismBridge prism;
private ExpireCheckTask expireCheckerTask;
private LunaChatLogger normalChatLogger;
@@ -98,6 +100,11 @@ public class LunaChat extends JavaPlugin {
getServer().getPluginManager().registerEvents(new McMMOBridge(), this);
}
+ // Prismのロード
+ if ( getServer().getPluginManager().isPluginEnabled("Prism") ) {
+ prism = PrismBridge.load();
+ }
+
// リスナーの登録
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
@@ -231,6 +238,14 @@ public class LunaChat extends JavaPlugin {
return multiverse;
}
+ /**
+ * Prism連携クラスを返す
+ * @return MultiverseCoreBridge
+ */
+ public PrismBridge getPrism() {
+ return prism;
+ }
+
/**
* 通常チャット用のロガーを返す
* @return normalChatLogger
diff --git a/src/main/java/com/github/ucchyocean/lc/LunaChatConfig.java b/src/main/java/com/github/ucchyocean/lc/LunaChatConfig.java
index 18cb0c4..daa101a 100644
--- a/src/main/java/com/github/ucchyocean/lc/LunaChatConfig.java
+++ b/src/main/java/com/github/ucchyocean/lc/LunaChatConfig.java
@@ -36,6 +36,9 @@ public class LunaChatConfig {
/** チャンネルチャットの発言内容を、HawkEyeに記録するかどうか */
private boolean loggingChatToHawkEye;
+ /** チャンネルチャットの発言内容を、Prismに記録するかどうか */
+ private boolean loggingChatToPrism;
+
/** チャンネルチャットの発言内容を、コンソールに表示するかどうか */
private boolean displayChatOnConsole;
@@ -171,6 +174,7 @@ public class LunaChatConfig {
noJoinAsGlobal = config.getBoolean("noJoinAsGlobal", true);
loggingChat = config.getBoolean("loggingChat", true);
loggingChatToHawkEye = config.getBoolean("loggingChatToHawkEye", true);
+ loggingChatToPrism = config.getBoolean("loggingChatToPrism", true);
displayChatOnConsole = config.getBoolean("displayChatOnConsole", true);
globalMarker = config.getString("globalMarker", "!");
zeroMemberRemove = config.getBoolean("zeroMemberRemove", false);
@@ -296,6 +300,14 @@ public class LunaChatConfig {
return loggingChatToHawkEye;
}
+ /**
+ * チャンネルチャットの発言内容を、Prismに記録するかどうか
+ * @return loggingChatToPrism
+ */
+ public boolean isLoggingChatToPrism() {
+ return loggingChatToPrism;
+ }
+
/**
* チャンネルチャットの発言内容を、コンソールに表示するかどうか
* @return displayChatOnConsoleを返す
diff --git a/src/main/java/com/github/ucchyocean/lc/bridge/HawkEyeBridge.java b/src/main/java/com/github/ucchyocean/lc/bridge/HawkEyeBridge.java
index d0b3dd4..83f5743 100644
--- a/src/main/java/com/github/ucchyocean/lc/bridge/HawkEyeBridge.java
+++ b/src/main/java/com/github/ucchyocean/lc/bridge/HawkEyeBridge.java
@@ -7,6 +7,7 @@ package com.github.ucchyocean.lc.bridge;
import org.bukkit.Location;
import org.bukkit.plugin.Plugin;
+import org.bukkit.scheduler.BukkitRunnable;
import com.github.ucchyocean.lc.LunaChat;
import com.github.ucchyocean.lc.Utility;
@@ -48,11 +49,15 @@ public class HawkEyeBridge {
*/
@SuppressWarnings("deprecation")
public void writeLog(String player, Location location, String data) {
- DataEntry entry = new DataEntry(player, DataType.CHAT, location, data);
- if ( isV162orLater ) {
- HawkEyeAPI.addEntry(entry);
- } else {
- HawkEyeAPI.addEntry(LunaChat.getInstance(), entry);
- }
+ final DataEntry entry = new DataEntry(player, DataType.CHAT, location, data);
+ new BukkitRunnable() {
+ public void run() {
+ if ( isV162orLater ) {
+ HawkEyeAPI.addEntry(entry);
+ } else {
+ HawkEyeAPI.addEntry(LunaChat.getInstance(), entry);
+ }
+ }
+ }.runTaskAsynchronously(LunaChat.getInstance());
}
}
diff --git a/src/main/java/com/github/ucchyocean/lc/bridge/PrismBridge.java b/src/main/java/com/github/ucchyocean/lc/bridge/PrismBridge.java
new file mode 100644
index 0000000..ec65840
--- /dev/null
+++ b/src/main/java/com/github/ucchyocean/lc/bridge/PrismBridge.java
@@ -0,0 +1,51 @@
+/*
+ * @author ucchy
+ * @license LGPLv3
+ * @copyright Copyright ucchy 2016
+ */
+package com.github.ucchyocean.lc.bridge;
+
+import org.bukkit.entity.Player;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import com.github.ucchyocean.lc.LunaChat;
+
+import me.botsko.prism.Prism;
+import me.botsko.prism.actionlibs.ActionFactory;
+import me.botsko.prism.actionlibs.RecordingQueue;
+
+/**
+ * Prism連携クラス
+ * @author ucchy
+ */
+public class PrismBridge {
+
+ /** コンストラクタは使用不可 */
+ private PrismBridge() {
+ }
+
+ /**
+ * Prism をロードする
+ * @return ロードしたブリッジのインスタンス
+ */
+ public static PrismBridge load() {
+ return new PrismBridge();
+ }
+
+ /**
+ * PrismにCHATログを書き出す
+ * @param player プレイヤー
+ * @param data データ
+ */
+ public void writeLog(final Player player, final String data) {
+ if ( !Prism.getIgnore().event( "player-chat", player ) ) {
+ return;
+ }
+ new BukkitRunnable() {
+ public void run() {
+ RecordingQueue.addToQueue( ActionFactory.createPlayer(
+ "player-chat", player, data ) );
+ }
+ }.runTaskAsynchronously(LunaChat.getInstance());
+ }
+}
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 81676a1..c434dc5 100644
--- a/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java
+++ b/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java
@@ -750,15 +750,26 @@ public class ChannelImpl extends Channel {
* @param player プレイヤー
*/
private void log(String message, String name, ChannelPlayer player) {
+
+ // LunaChatのチャットログへ記録
LunaChatConfig config = LunaChat.getInstance().getLunaChatConfig();
if ( config.isLoggingChat() && logger != null ) {
logger.log(message, name);
}
+
+ // Hawkeye Reloaded のチャットログへ記録
if ( config.isLoggingChatToHawkEye() && LunaChat.getInstance().getHawkEye() != null
&& player != null && player.getLocation() != null ) {
LunaChat.getInstance().getHawkEye().writeLog(name, player.getLocation(),
"channel(" + getName() + ")-" + Utility.stripColor(message));
}
+
+ // Prism のチャットログへ記録
+ if ( config.isLoggingChatToPrism() && LunaChat.getInstance().getPrism() != null
+ && player.getPlayer() != null ) {
+ LunaChat.getInstance().getPrism().writeLog(player.getPlayer(),
+ "channel(" + getName() + ")-" + Utility.stripColor(message));
+ }
}
/**
diff --git a/src/main/resources/config_ja.yml b/src/main/resources/config_ja.yml
index b7fe0a6..13b2fac 100644
--- a/src/main/resources/config_ja.yml
+++ b/src/main/resources/config_ja.yml
@@ -29,6 +29,11 @@ loggingChat: true
# この設定を利用する場合は、HawkEyeのconfig.ymlで、log: セクションの chat の設定を true にしてください。
loggingChatToHawkEye: true
+# チャンネルチャットの発言内容を、Prismに記録するかどうか
+# この設定を利用する場合は、Prismのconfig.ymlで、
+# tracking: セクションの player-chat の設定を true にしてください。
+loggingChatToPrism: true
+
# チャンネルチャットの発言内容を、サーバーコンソールに表示するかどうか
displayChatOnConsole: true