コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
f7f741d926 | ||
|
|
c9e4d01a68 | ||
|
|
fdeb9d0610 |
検索条件に一致するファイルはありません
@@ -13,6 +13,7 @@
|
||||
<files>
|
||||
<file>
|
||||
<source>target/LunaChat.jar</source>
|
||||
<destName>plugins/LunaChat.jar</destName>
|
||||
</file>
|
||||
</files>
|
||||
|
||||
|
||||
バイナリ
バイナリファイルは表示されません。
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.ucchyocean</groupId>
|
||||
<artifactId>LunaChat</artifactId>
|
||||
<version>2.7.2</version>
|
||||
<version>2.7.4</version>
|
||||
<description>チャンネルチャットプラグイン</description>
|
||||
|
||||
<licenses>
|
||||
@@ -107,17 +107,24 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.8.7-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>Vault</artifactId>
|
||||
<version>1.5.2</version>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dynmap</groupId>
|
||||
<artifactId>dynmap-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.oliwali</groupId>
|
||||
<artifactId>HawkEye</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/HawkEye.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -11,13 +11,12 @@ import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerialization;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.github.ucchyocean.lc.bridge.DynmapBridge;
|
||||
import com.github.ucchyocean.lc.bridge.HawkEyeBridge;
|
||||
import com.github.ucchyocean.lc.bridge.VaultChatBridge;
|
||||
import com.github.ucchyocean.lc.channel.Channel;
|
||||
import com.github.ucchyocean.lc.channel.ChannelManager;
|
||||
import com.github.ucchyocean.lc.command.LunaChatCommand;
|
||||
import com.github.ucchyocean.lc.command.LunaChatJapanizeCommand;
|
||||
@@ -37,6 +36,7 @@ public class LunaChat extends JavaPlugin {
|
||||
|
||||
private VaultChatBridge vaultchat;
|
||||
private DynmapBridge dynmap;
|
||||
private HawkEyeBridge hawkeye;
|
||||
|
||||
private ExpireCheckTask expireCheckerTask;
|
||||
private LunaChatLogger normalChatLogger;
|
||||
@@ -78,6 +78,11 @@ public class LunaChat extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
// HawkEye のロード
|
||||
if ( getServer().getPluginManager().isPluginEnabled("HawkEye") ) {
|
||||
hawkeye = new HawkEyeBridge(this);
|
||||
}
|
||||
|
||||
// リスナーの登録
|
||||
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
|
||||
|
||||
@@ -87,9 +92,6 @@ public class LunaChat extends JavaPlugin {
|
||||
replyCommand = new LunaChatReplyCommand();
|
||||
lcjapanizeCommand = new LunaChatJapanizeCommand();
|
||||
|
||||
// シリアル化可能オブジェクトの登録
|
||||
ConfigurationSerialization.registerClass(Channel.class, "Channel");
|
||||
|
||||
// 期限チェッカータスクの起動
|
||||
expireCheckerTask = new ExpireCheckTask();
|
||||
expireCheckerTask.runTaskTimerAsynchronously(this, 100, 600);
|
||||
@@ -198,6 +200,14 @@ public class LunaChat extends JavaPlugin {
|
||||
return dynmap;
|
||||
}
|
||||
|
||||
/**
|
||||
* HawkEye連携クラスを返す
|
||||
* @return HawkEyeBridge
|
||||
*/
|
||||
public HawkEyeBridge getHawkEye() {
|
||||
return hawkeye;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通常チャット用のロガーを返す
|
||||
* @return normalChatLogger
|
||||
|
||||
@@ -29,6 +29,9 @@ public class LunaChatConfig {
|
||||
/** チャンネルチャットの発言内容を、ログに残すかどうか */
|
||||
private boolean loggingChat;
|
||||
|
||||
/** チャンネルチャットの発言内容を、HawkEyeに記録するかどうか */
|
||||
private boolean loggingChatToHawkEye;
|
||||
|
||||
/** チャンネルチャットの発言内容を、コンソールに表示するかどうか */
|
||||
private boolean displayChatOnConsole;
|
||||
|
||||
@@ -156,6 +159,7 @@ public class LunaChatConfig {
|
||||
enableChannelChat = config.getBoolean("enableChannelChat", true);
|
||||
noJoinAsGlobal = config.getBoolean("noJoinAsGlobal", true);
|
||||
loggingChat = config.getBoolean("loggingChat", true);
|
||||
loggingChatToHawkEye = config.getBoolean("loggingChatToHawkEye", true);
|
||||
displayChatOnConsole = config.getBoolean("displayChatOnConsole", true);
|
||||
globalMarker = config.getString("globalMarker", "!");
|
||||
zeroMemberRemove = config.getBoolean("zeroMemberRemove", false);
|
||||
@@ -262,6 +266,14 @@ public class LunaChatConfig {
|
||||
return loggingChat;
|
||||
}
|
||||
|
||||
/**
|
||||
* チャンネルチャットの発言内容を、HawkEyeに記録するかどうか
|
||||
* @return loggingChatToHawkEye
|
||||
*/
|
||||
public boolean isLoggingChatToHawkEye() {
|
||||
return loggingChatToHawkEye;
|
||||
}
|
||||
|
||||
/**
|
||||
* チャンネルチャットの発言内容を、コンソールに表示するかどうか
|
||||
* @return displayChatOnConsoleを返す
|
||||
|
||||
@@ -301,4 +301,14 @@ public class Utility {
|
||||
return null;
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定された名前のプレイヤーを取得する
|
||||
* @param name プレイヤー名
|
||||
* @return プレイヤー
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Player getPlayerExact(String name) {
|
||||
return Bukkit.getPlayer(name);
|
||||
}
|
||||
}
|
||||
@@ -96,6 +96,7 @@ public class DynmapBridge implements Listener {
|
||||
channel.chatFromOtherSource(
|
||||
event.getName(), event.getSource(), event.getMessage());
|
||||
event.setProcessed();
|
||||
dynmap.sendBroadcastToWeb(null, event.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* @author ucchy
|
||||
* @license LGPLv3
|
||||
* @copyright Copyright ucchy 2015
|
||||
*/
|
||||
package com.github.ucchyocean.lc.bridge;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import uk.co.oliwali.HawkEye.util.HawkEyeAPI;
|
||||
|
||||
/**
|
||||
* HawkEye連携クラス
|
||||
* @author ucchy
|
||||
*/
|
||||
public class HawkEyeBridge {
|
||||
|
||||
private JavaPlugin lunaChatInstance;
|
||||
|
||||
public HawkEyeBridge(JavaPlugin lunaChatInstance) {
|
||||
this.lunaChatInstance = lunaChatInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* HawkEyeにログを書き出す
|
||||
* @param action アクション
|
||||
* @param player プレイヤー
|
||||
* @param location 場所
|
||||
* @param data データ
|
||||
*/
|
||||
public void writeLog(String action, Player player, Location location, String data) {
|
||||
HawkEyeAPI.addCustomEntry(lunaChatInstance, action, player, location, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* HawkEyeにログを書き出す
|
||||
* @param action アクション
|
||||
* @param player プレイヤー名
|
||||
* @param location 場所
|
||||
* @param data データ
|
||||
*/
|
||||
public void writeLog(String action, String player, Location location, String data) {
|
||||
HawkEyeAPI.addCustomEntry(lunaChatInstance, action, player, location, data);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
package com.github.ucchyocean.lc.bridge;
|
||||
|
||||
import net.milkbowl.vault.Vault;
|
||||
import net.milkbowl.vault.chat.Chat;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -33,14 +32,12 @@ public class VaultChatBridge {
|
||||
*/
|
||||
public static VaultChatBridge load(Plugin plugin) {
|
||||
|
||||
if ( plugin instanceof Vault ) {
|
||||
RegisteredServiceProvider<Chat> chatProvider =
|
||||
Bukkit.getServicesManager().getRegistration(Chat.class);
|
||||
if ( chatProvider != null ) {
|
||||
VaultChatBridge bridge = new VaultChatBridge();
|
||||
bridge.chatPlugin = chatProvider.getProvider();
|
||||
return bridge;
|
||||
}
|
||||
RegisteredServiceProvider<Chat> chatProvider =
|
||||
Bukkit.getServicesManager().getRegistration(Chat.class);
|
||||
if ( chatProvider != null ) {
|
||||
VaultChatBridge bridge = new VaultChatBridge();
|
||||
bridge.chatPlugin = chatProvider.getProvider();
|
||||
return bridge;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -364,9 +364,10 @@ public abstract class Channel implements ConfigurationSerializable {
|
||||
* @param message メッセージ
|
||||
* @param format フォーマット
|
||||
* @param sendDynmap dynmapへ送信するかどうか
|
||||
* @param displayName 発言者の表示名(APIに使用されます)
|
||||
*/
|
||||
public abstract void sendMessage(
|
||||
ChannelPlayer player, String message, String format, boolean sendDynmap);
|
||||
ChannelPlayer player, String message, String format, boolean sendDynmap, String displayName);
|
||||
|
||||
/**
|
||||
* チャンネル情報を返す
|
||||
|
||||
@@ -101,7 +101,7 @@ public class ChannelImpl extends Channel {
|
||||
LunaChatAPI api = LunaChat.getInstance().getLunaChatAPI();
|
||||
|
||||
// Muteされているかどうかを確認する
|
||||
if ( player != null && getMuted().contains(player) ) {
|
||||
if ( getMuted().contains(player) ) {
|
||||
player.sendMessage( PREERR + ERRMSG_MUTED );
|
||||
return;
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public class ChannelImpl extends Channel {
|
||||
|
||||
if ( isIncludeSyncChat ) {
|
||||
// メッセージの送信
|
||||
sendMessage(player, maskedMessage, msgFormat, true);
|
||||
sendMessage(player, maskedMessage, msgFormat, true, player.getDisplayName());
|
||||
}
|
||||
|
||||
// 非同期実行タスクがある場合、追加で実行する
|
||||
@@ -204,7 +204,7 @@ public class ChannelImpl extends Channel {
|
||||
String m = replaceKeywordsForSystemMessages(
|
||||
MSG_BAN_NGWORD, player.getName());
|
||||
player.sendMessage(m);
|
||||
sendMessage(null, m, null, true);
|
||||
sendMessage(null, m, null, true, "system");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ public class ChannelImpl extends Channel {
|
||||
String m = replaceKeywordsForSystemMessages(
|
||||
MSG_KICK_NGWORD, player.getName());
|
||||
player.sendMessage(m);
|
||||
sendMessage(null, m, null, true);
|
||||
sendMessage(null, m, null, true, "system");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ public class ChannelImpl extends Channel {
|
||||
String m = replaceKeywordsForSystemMessages(
|
||||
MSG_MUTE_NGWORD, player.getName());
|
||||
player.sendMessage(m);
|
||||
sendMessage(null, m, null, true);
|
||||
sendMessage(null, m, null, true, "system");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -271,7 +271,8 @@ public class ChannelImpl extends Channel {
|
||||
}
|
||||
|
||||
// メッセージの送信
|
||||
sendMessage(null, maskedMessage, msgFormat, false);
|
||||
boolean sendDynmap = source == null || !source.equals("web");
|
||||
sendMessage(null, maskedMessage, msgFormat, sendDynmap, name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,7 +293,7 @@ public class ChannelImpl extends Channel {
|
||||
return;
|
||||
}
|
||||
msg = replaceKeywordsForSystemMessages(msg, player.getName());
|
||||
sendMessage(null, msg, null, false);
|
||||
sendMessage(null, msg, null, false, "system");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -301,10 +302,11 @@ public class ChannelImpl extends Channel {
|
||||
* @param message メッセージ
|
||||
* @param format フォーマット
|
||||
* @param sendDynmap dynmapへ送信するかどうか
|
||||
* @param name 発言者名
|
||||
*/
|
||||
@Override
|
||||
public void sendMessage(ChannelPlayer player, String message,
|
||||
String format, boolean sendDynmap) {
|
||||
String format, boolean sendDynmap, String name) {
|
||||
|
||||
LunaChatConfig config = LunaChat.getInstance().getLunaChatConfig();
|
||||
|
||||
@@ -404,7 +406,7 @@ public class ChannelImpl extends Channel {
|
||||
// イベントコール
|
||||
LunaChatChannelMessageEvent event =
|
||||
new LunaChatChannelMessageEvent(
|
||||
getName(), player, message, recipients);
|
||||
getName(), player, message, recipients, name, originalMessage);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
message = event.getMessage();
|
||||
recipients = event.getRecipients();
|
||||
@@ -448,8 +450,7 @@ public class ChannelImpl extends Channel {
|
||||
}
|
||||
|
||||
// ロギング
|
||||
String p = (player != null) ? player.getName() : "";
|
||||
log(originalMessage, p);
|
||||
log(originalMessage, name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -615,7 +616,7 @@ public class ChannelImpl extends Channel {
|
||||
// メッセージ通知を流す
|
||||
if ( !MSG_BAN_EXPIRED.equals("") ) {
|
||||
String msg = replaceKeywords(MSG_BAN_EXPIRED, cp);
|
||||
sendMessage(null, msg, null, false);
|
||||
sendMessage(null, msg, null, false, "system");
|
||||
}
|
||||
|
||||
if ( cp.isOnline() && !MSG_BAN_EXPIRED_PLAYER.equals("") ) {
|
||||
@@ -639,7 +640,7 @@ public class ChannelImpl extends Channel {
|
||||
// メッセージ通知を流す
|
||||
if ( !MSG_MUTE_EXPIRED.equals("") ) {
|
||||
String msg = replaceKeywords(MSG_MUTE_EXPIRED, cp);
|
||||
sendMessage(null, msg, null, false);
|
||||
sendMessage(null, msg, null, false, "system");
|
||||
}
|
||||
|
||||
if ( cp.isOnline() && !MSG_MUTE_EXPIRED_PLAYER.equals("") ) {
|
||||
@@ -730,6 +731,15 @@ public class ChannelImpl extends Channel {
|
||||
if ( config.isLoggingChat() && logger != null ) {
|
||||
logger.log(message, player);
|
||||
}
|
||||
if ( config.isLoggingChatToHawkEye() && LunaChat.getInstance().getHawkEye() != null ) {
|
||||
Location location = null;
|
||||
Player pl = Utility.getPlayerExact(player);
|
||||
if ( pl != null ) {
|
||||
location = pl.getLocation();
|
||||
}
|
||||
String data = Utility.stripColor(message);
|
||||
LunaChat.getInstance().getHawkEye().writeLog("channel(" + getName() + ")", player, location, data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,8 @@ public class DelayedJapanizeChannelChatTask extends DelayedJapanizeConvertTask {
|
||||
public void run() {
|
||||
if ( runSync() ) {
|
||||
// チャンネルへ送信
|
||||
channel.sendMessage(player, getResult(), lineFormat, true);
|
||||
String name = (player != null) ? player.getDisplayName() : "";
|
||||
channel.sendMessage(player, getResult(), lineFormat, true, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public abstract class SubCommandAbst {
|
||||
msg = msg.replace("%player", "");
|
||||
}
|
||||
msg = Utility.replaceColorCode(msg);
|
||||
channel.sendMessage(null, msg, null, true);
|
||||
channel.sendMessage(null, msg, null, true, "system");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ public abstract class SubCommandAbst {
|
||||
msg = msg.replace("%player", "");
|
||||
}
|
||||
msg = Utility.replaceColorCode(msg);
|
||||
channel.sendMessage(null, msg, null, true);
|
||||
channel.sendMessage(null, msg, null, true, "system");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,13 +19,18 @@ public class LunaChatChannelMessageEvent extends LunaChatBaseEvent {
|
||||
private ChannelPlayer player;
|
||||
private String message;
|
||||
private ArrayList<ChannelPlayer> recipients;
|
||||
private String displayName;
|
||||
private String originalMessage;
|
||||
|
||||
public LunaChatChannelMessageEvent(String channelName,
|
||||
ChannelPlayer player, String message, ArrayList<ChannelPlayer> recipients) {
|
||||
ChannelPlayer player, String message, ArrayList<ChannelPlayer> recipients,
|
||||
String displayName, String originalMessage) {
|
||||
super(channelName);
|
||||
this.player = player;
|
||||
this.message = message;
|
||||
this.recipients = recipients;
|
||||
this.displayName = displayName;
|
||||
this.originalMessage = originalMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,6 +57,22 @@ public class LunaChatChannelMessageEvent extends LunaChatBaseEvent {
|
||||
return recipients;
|
||||
}
|
||||
|
||||
/**
|
||||
* 発言者の表示名を取得する
|
||||
* @return 発言者の表示名
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* オリジナルメッセージ(チャットフォーマットを適用していない状態のメッセージ)を取得する
|
||||
* @return オリジナルメッセージ
|
||||
*/
|
||||
public String getOriginalMessage() {
|
||||
return originalMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* メッセージを上書き設定する
|
||||
* @param message メッセージ
|
||||
|
||||
@@ -16,6 +16,10 @@ noJoinAsGlobal: true
|
||||
# チャンネルチャットの発言内容を、ログに残すかどうか
|
||||
loggingChat: true
|
||||
|
||||
# チャンネルチャットの発言内容を、HawkEyeに記録するかどうか
|
||||
# この設定を利用する場合は、HawkEyeのconfig.ymlで、log: セクションの other の設定を true にしてください。
|
||||
loggingChatToHawkEye: true
|
||||
|
||||
# チャンネルチャットの発言内容を、サーバーコンソールに表示するかどうか
|
||||
displayChatOnConsole: true
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ main: com.github.ucchyocean.lc.LunaChat
|
||||
version: ${project.version}
|
||||
author: ucchy
|
||||
description: ${project.description}
|
||||
softdepend: [Vault, dynmap]
|
||||
softdepend: [Vault, dynmap, HawkEye]
|
||||
|
||||
commands:
|
||||
lunachat:
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする