コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
2e032f9ecf | ||
|
|
f7f741d926 | ||
|
|
c9e4d01a68 | ||
|
|
fdeb9d0610 | ||
|
|
2b0e3a9b97 | ||
|
|
e053d72010 | ||
|
|
eeb1a28911 | ||
|
|
dca18b87e4 |
検索条件に一致するファイルはありません
@@ -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.1</version>
|
||||
<version>2.7.5</version>
|
||||
<description>チャンネルチャットプラグイン</description>
|
||||
|
||||
<licenses>
|
||||
@@ -97,9 +97,9 @@
|
||||
<url>http://repo.mikeprimm.com/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>rasagne-repo</id>
|
||||
<name>Craft Bukkit Alternate Nexus Repository</name>
|
||||
<url>http://lasagne.tgnmc.com:8081/nexus/content/groups/public</url>
|
||||
<id>spigot-repo</id>
|
||||
<name>Spigot Maven Repository</name>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
@@ -107,17 +107,24 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.8-R0.1-SNAPSHOT</version>
|
||||
<version>1.8.8-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を返す
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
@@ -24,7 +25,7 @@ import com.github.ucchyocean.lc.channel.Channel;
|
||||
import com.github.ucchyocean.lc.channel.ChannelPlayer;
|
||||
import com.github.ucchyocean.lc.channel.ChannelPlayerName;
|
||||
import com.github.ucchyocean.lc.channel.ChannelPlayerUUID;
|
||||
import com.github.ucchyocean.lc.channel.DelayedJapanizeConvertTask;
|
||||
import com.github.ucchyocean.lc.channel.DelayedJapanizeNormalChatTask;
|
||||
import com.github.ucchyocean.lc.event.LunaChatPreChatEvent;
|
||||
import com.github.ucchyocean.lc.japanize.JapanizeType;
|
||||
|
||||
@@ -42,7 +43,7 @@ public class PlayerListener implements Listener {
|
||||
* プレイヤーのチャットごとに呼び出されるメソッド
|
||||
* @param event チャットイベント
|
||||
*/
|
||||
@EventHandler
|
||||
@EventHandler(priority=EventPriority.HIGH, ignoreCancelled=true)
|
||||
public void onChat(AsyncPlayerChatEvent event) {
|
||||
|
||||
LunaChatConfig config = LunaChat.getInstance().getLunaChatConfig();
|
||||
@@ -235,6 +236,14 @@ public class PlayerListener implements Listener {
|
||||
message = Utility.replaceColorCode(message);
|
||||
}
|
||||
|
||||
// hideされているプレイヤーを、recipientから抜く
|
||||
for ( ChannelPlayer cp : api.getHidelist(player) ) {
|
||||
Player p = cp.getPlayer();
|
||||
if ( p != null ) {
|
||||
event.getRecipients().remove(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 一時的にJapanizeスキップ設定かどうかを確認する
|
||||
boolean skipJapanize = false;
|
||||
@@ -274,8 +283,8 @@ public class PlayerListener implements Listener {
|
||||
|
||||
String taskFormat = Utility.replaceColorCode(config.getJapanizeLine2Format());
|
||||
|
||||
DelayedJapanizeConvertTask task = new DelayedJapanizeConvertTask(message,
|
||||
config.getJapanizeType(), null, player, taskFormat, null);
|
||||
DelayedJapanizeNormalChatTask task = new DelayedJapanizeNormalChatTask(
|
||||
message, config.getJapanizeType(), player, taskFormat, event);
|
||||
|
||||
// 発言処理を必ず先に実施させるため、遅延を入れてタスクを実行する。
|
||||
int wait = config.getJapanizeWait();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -178,13 +178,13 @@ public class ChannelImpl extends Channel {
|
||||
}
|
||||
|
||||
// タスクを作成しておく
|
||||
delayedTask = new DelayedJapanizeConvertTask(maskedMessage,
|
||||
delayedTask = new DelayedJapanizeChannelChatTask(maskedMessage,
|
||||
japanizeType, this, player, jpFormat, messageFormat);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -645,7 +645,7 @@ public class ChannelManager implements LunaChatAPI {
|
||||
|
||||
// Japanize変換タスクを作成して、同期で実行する。
|
||||
DelayedJapanizeConvertTask task = new DelayedJapanizeConvertTask(
|
||||
message, type, null, null, "%japanize", null);
|
||||
message, type, null, null, "%japanize");
|
||||
if ( task.runSync() ) {
|
||||
return task.getResult();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* @author ucchy
|
||||
* @license LGPLv3
|
||||
* @copyright Copyright ucchy 2015
|
||||
*/
|
||||
package com.github.ucchyocean.lc.channel;
|
||||
|
||||
import com.github.ucchyocean.lc.japanize.JapanizeType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ucchy
|
||||
*/
|
||||
public class DelayedJapanizeChannelChatTask extends DelayedJapanizeConvertTask {
|
||||
|
||||
private Channel channel;
|
||||
private ChannelPlayer player;
|
||||
private String lineFormat;
|
||||
|
||||
/**
|
||||
* コンストラクタ
|
||||
* @param org 変換前の文字列
|
||||
* @param type 変換タイプ
|
||||
* @param channel 変換後に発言する、発言先チャンネル
|
||||
* @param player 発言したプレイヤー
|
||||
* @param japanizeFormat 変換後に発言するときの、発言フォーマット
|
||||
* @param lineFormat
|
||||
*/
|
||||
public DelayedJapanizeChannelChatTask(String org, JapanizeType type, Channel channel,
|
||||
ChannelPlayer player, String japanizeFormat, String lineFormat) {
|
||||
super(org, type, channel, player, japanizeFormat);
|
||||
this.channel = channel;
|
||||
this.player = player;
|
||||
this.lineFormat = lineFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
if ( runSync() ) {
|
||||
// チャンネルへ送信
|
||||
String name = (player != null) ? player.getDisplayName() : "";
|
||||
channel.sendMessage(player, getResult(), lineFormat, true, name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,7 +34,6 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
|
||||
private Channel channel;
|
||||
private ChannelPlayer player;
|
||||
private String format;
|
||||
private String lineFormat;
|
||||
private String result;
|
||||
|
||||
/**
|
||||
@@ -46,40 +45,17 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
|
||||
* @param japanizeFormat 変換後に発言するときの、発言フォーマット
|
||||
*/
|
||||
public DelayedJapanizeConvertTask(String org, JapanizeType type, Channel channel,
|
||||
ChannelPlayer player, String japanizeFormat, String lineFormat) {
|
||||
ChannelPlayer player, String japanizeFormat) {
|
||||
this.org = org;
|
||||
this.type = type;
|
||||
this.channel = channel;
|
||||
this.player = player;
|
||||
this.format = japanizeFormat;
|
||||
this.lineFormat = lineFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if ( runSync() ) {
|
||||
|
||||
// チャンネルへ送信
|
||||
if ( channel != null ) {
|
||||
channel.sendMessage(player, result, lineFormat, true);
|
||||
} else {
|
||||
Bukkit.broadcastMessage(result);
|
||||
|
||||
// 設定に応じてdynmapへ送信する
|
||||
if ( LunaChat.getInstance().getLunaChatConfig().
|
||||
isSendBroadcastChannelChatToDynmap() &&
|
||||
LunaChat.getInstance().getDynmap() != null ) {
|
||||
if ( player != null && player.getPlayer() != null )
|
||||
LunaChat.getInstance().getDynmap().chat(player.getPlayer(), result);
|
||||
else
|
||||
LunaChat.getInstance().getDynmap().broadcast(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
runSync();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* @author ucchy
|
||||
* @license LGPLv3
|
||||
* @copyright Copyright ucchy 2015
|
||||
*/
|
||||
package com.github.ucchyocean.lc.channel;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
import com.github.ucchyocean.lc.LunaChat;
|
||||
import com.github.ucchyocean.lc.japanize.JapanizeType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ucchy
|
||||
*/
|
||||
public class DelayedJapanizeNormalChatTask extends DelayedJapanizeConvertTask {
|
||||
|
||||
private ChannelPlayer player;
|
||||
private AsyncPlayerChatEvent event;
|
||||
|
||||
/**
|
||||
* コンストラクタ
|
||||
* @param org 変換前の文字列
|
||||
* @param type 変換タイプ
|
||||
* @param player 発言したプレイヤー
|
||||
* @param japanizeFormat 変換後に発言するときの、発言フォーマット
|
||||
* @param event イベント
|
||||
*/
|
||||
public DelayedJapanizeNormalChatTask(String org, JapanizeType type,
|
||||
ChannelPlayer player, String japanizeFormat, final AsyncPlayerChatEvent event) {
|
||||
super(org, type, null, player, japanizeFormat);
|
||||
this.player = player;
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if ( runSync() ) {
|
||||
|
||||
String result = getResult();
|
||||
|
||||
// 送信
|
||||
for ( Player p : event.getRecipients() ) {
|
||||
p.sendMessage(result);
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(result);
|
||||
|
||||
// 設定に応じてdynmapへ送信する
|
||||
if ( LunaChat.getInstance().getLunaChatConfig().
|
||||
isSendBroadcastChannelChatToDynmap() &&
|
||||
LunaChat.getInstance().getDynmap() != null ) {
|
||||
if ( player != null && player.getPlayer() != null )
|
||||
LunaChat.getInstance().getDynmap().chat(player.getPlayer(), result);
|
||||
else
|
||||
LunaChat.getInstance().getDynmap().broadcast(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,9 @@ public class InviteCommand extends SubCommandAbst {
|
||||
private static final String PERMISSION_NODE = "lunachat." + COMMAND_NAME;
|
||||
private static final String USAGE_KEY = "usageInvite";
|
||||
|
||||
private static final String PERMISSION_NODE_FORCE_INVITE
|
||||
= "lunachat-admin.force-invite";
|
||||
|
||||
/**
|
||||
* コマンドを取得します。
|
||||
* @return コマンド
|
||||
@@ -74,6 +77,22 @@ public class InviteCommand extends SubCommandAbst {
|
||||
@Override
|
||||
public boolean runCommand(CommandSender sender, String label, String[] args) {
|
||||
|
||||
if ( args.length >= 3 && args[2].equalsIgnoreCase("force") ) {
|
||||
return runForceInviteCommand(sender, label, args);
|
||||
}
|
||||
|
||||
return runNormalInviteCommand(sender, label, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通常のinviteコマンドを処理する
|
||||
* @param sender
|
||||
* @param label
|
||||
* @param args
|
||||
* @return
|
||||
*/
|
||||
private boolean runNormalInviteCommand(CommandSender sender, String label, String[] args) {
|
||||
|
||||
// プレイヤーでなければ終了する
|
||||
if (!(sender instanceof Player)) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgIngame");
|
||||
@@ -129,4 +148,74 @@ public class InviteCommand extends SubCommandAbst {
|
||||
sendResourceMessage(invited, PREINFO, "cmdmsgInvited2");
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 強制入室コマンドを処理する
|
||||
* @param sender
|
||||
* @param label
|
||||
* @param args
|
||||
* @return
|
||||
*/
|
||||
private boolean runForceInviteCommand(CommandSender sender, String label, String[] args) {
|
||||
|
||||
// パーミッションチェック
|
||||
if ( !sender.hasPermission(PERMISSION_NODE_FORCE_INVITE) ) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgPermission",
|
||||
PERMISSION_NODE_FORCE_INVITE);
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
// 引数チェック
|
||||
// このコマンドは、コンソールでも実行できるが、その場合はチャンネル名を指定する必要がある
|
||||
String cname = null;
|
||||
if ( player != null && args.length <= 3 ) {
|
||||
Channel def = api.getDefaultChannel(player.getName());
|
||||
if ( def != null ) {
|
||||
cname = def.getName();
|
||||
}
|
||||
} else if ( args.length >= 4 ) {
|
||||
cname = args[3];
|
||||
} else {
|
||||
sendResourceMessage(sender, PREERR, "errmsgCommand");
|
||||
return true;
|
||||
}
|
||||
|
||||
// チャンネルが存在するかどうか確認する
|
||||
Channel channel = api.getChannel(cname);
|
||||
if ( channel == null ) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgNotExist");
|
||||
return true;
|
||||
}
|
||||
|
||||
// 招待相手が存在するかどうかを確認する
|
||||
String invitedName = args[1];
|
||||
ChannelPlayer invited = ChannelPlayer.getChannelPlayer(invitedName);
|
||||
if ( invited == null || !invited.isOnline() ) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgNotfoundPlayer", invitedName);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 招待相手が既にチャンネルに参加しているかどうかを確認する
|
||||
if (channel.getMembers().contains(invited)) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgInvitedAlreadyExist", invitedName);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 参加する
|
||||
channel.addMember(invited);
|
||||
api.setDefaultChannel(invitedName, cname);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgInvite", invitedName, channel.getName());
|
||||
sendResourceMessage(invited, PREINFO,
|
||||
"cmdmsgJoin", channel.getName());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ public class LunaChatCommand implements CommandExecutor {
|
||||
private static final String PREERR = Resources.get("errorPrefix");
|
||||
|
||||
private ArrayList<SubCommandAbst> commands;
|
||||
private ArrayList<SubCommandAbst> commonCommands;
|
||||
private JoinCommand joinCommand;
|
||||
private HelpCommand helpCommand;
|
||||
|
||||
@@ -49,8 +50,6 @@ public class LunaChatCommand implements CommandExecutor {
|
||||
commands.add(new PardonCommand());
|
||||
commands.add(new MuteCommand());
|
||||
commands.add(new UnmuteCommand());
|
||||
commands.add(new HideCommand());
|
||||
commands.add(new UnhideCommand());
|
||||
commands.add(new InfoCommand());
|
||||
commands.add(new LogCommand());
|
||||
commands.add(new CreateCommand());
|
||||
@@ -58,14 +57,18 @@ public class LunaChatCommand implements CommandExecutor {
|
||||
commands.add(new FormatCommand());
|
||||
commands.add(new ModeratorCommand());
|
||||
commands.add(new ModCommand());
|
||||
commands.add(new DictionaryCommand());
|
||||
commands.add(new DicCommand());
|
||||
commands.add(new OptionCommand());
|
||||
commands.add(new TemplateCommand());
|
||||
commands.add(new CheckCommand());
|
||||
commands.add(new ReloadCommand());
|
||||
helpCommand = new HelpCommand(commands);
|
||||
commands.add(helpCommand);
|
||||
|
||||
commonCommands = new ArrayList<SubCommandAbst>();
|
||||
commonCommands.add(new HideCommand());
|
||||
commonCommands.add(new UnhideCommand());
|
||||
commonCommands.add(new DictionaryCommand());
|
||||
commonCommands.add(new DicCommand());
|
||||
commonCommands.add(new ReloadCommand());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,6 +78,25 @@ public class LunaChatCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command,
|
||||
String label, String[] args) {
|
||||
|
||||
// チャンネルチャットが無効でも利用できるコマンドはここで処理する
|
||||
// (hide, unhide, dic, dictionary, reload)
|
||||
if ( args.length >= 1 ) {
|
||||
for ( SubCommandAbst c : commonCommands ) {
|
||||
if ( c.getCommandName().equalsIgnoreCase(args[0]) ) {
|
||||
|
||||
// パーミッションの確認
|
||||
String node = c.getPermissionNode();
|
||||
if ( !sender.hasPermission(node) ) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgPermission", node);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 実行
|
||||
return c.runCommand(sender, label, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// チャンネルチャット機能が無効になっている場合は、メッセージを表示して終了
|
||||
if ( !LunaChat.getInstance().getLunaChatConfig().isEnableChannelChat()
|
||||
&& !sender.isOp() ) {
|
||||
|
||||
@@ -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 メッセージ
|
||||
|
||||
@@ -47,16 +47,20 @@ public class IMEConverter {
|
||||
// 変換の実行
|
||||
private static String conv(String org, boolean isGoogleIME) {
|
||||
|
||||
if ( org.length() == 0 ) {
|
||||
return "";
|
||||
}
|
||||
|
||||
HttpURLConnection urlconn = null;
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
String baseurl;
|
||||
String encode;
|
||||
if ( isGoogleIME ) {
|
||||
baseurl = GOOGLE_IME_URL + URLEncoder.encode(org , "UTF-8");;
|
||||
baseurl = GOOGLE_IME_URL + URLEncoder.encode(org , "UTF-8");
|
||||
encode = "UTF-8";
|
||||
} else {
|
||||
baseurl = SOCIAL_IME_URL + URLEncoder.encode(org , "UTF-8");;
|
||||
baseurl = SOCIAL_IME_URL + URLEncoder.encode(org , "UTF-8");
|
||||
encode = "EUC_JP";
|
||||
}
|
||||
URL url = new URL(baseurl);
|
||||
|
||||
@@ -16,6 +16,10 @@ noJoinAsGlobal: true
|
||||
# チャンネルチャットの発言内容を、ログに残すかどうか
|
||||
loggingChat: true
|
||||
|
||||
# チャンネルチャットの発言内容を、HawkEyeに記録するかどうか
|
||||
# この設定を利用する場合は、HawkEyeのconfig.ymlで、log: セクションの other の設定を true にしてください。
|
||||
loggingChatToHawkEye: true
|
||||
|
||||
# チャンネルチャットの発言内容を、サーバーコンソールに表示するかどうか
|
||||
displayChatOnConsole: true
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ usageHidePlayer: '&6/%s hide (player) &7- 指定したプレイヤーの発言
|
||||
usageUnhide: '&6/%s unhide [channel] &7- 指定したチャンネルの発言内容を非表示から表示に戻します。'
|
||||
usageUnhidePlayer: '&6/%s unhide (player) &7- 指定したプレイヤーの発言内容を非表示から表示に戻します。'
|
||||
usageInfo: '&6/%s info [channel] &7- チャンネルの情報を表示します。'
|
||||
usageLog: '&6/%s log [channel] [p=player] [f=filter] [f=date] [r] &7- チャンネルの発言ログを表示します。'
|
||||
usageLog: '&6/%s log [channel] [p=player] [f=filter] [d=date] [r] &7- チャンネルの発言ログを表示します。'
|
||||
|
||||
usageCreate: '&6/%s create (channel) [description] &7- チャンネルを作成します。'
|
||||
usageRemove: '&6/%s remove [channel] &7- チャンネルを削除します。'
|
||||
|
||||
@@ -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:
|
||||
@@ -13,7 +13,7 @@ commands:
|
||||
/<command> join (channel) - チャンネルに参加します。
|
||||
/<command> leave - 参加しているチャンネルから退出します。
|
||||
/<command> list - チャンネルのリストを表示します。
|
||||
/<command> invite (name) - 指定した人をチャンネルチャットに招待します。
|
||||
/<command> invite (name) [force] - 指定した人をチャンネルチャットに招待します。
|
||||
/<command> accept - 招待を受けてチャンネルチャットに入室します。
|
||||
/<command> deny - 招待を拒否します。
|
||||
/<command> kick (name) - 指定した人をチャンネルチャットからキックします。
|
||||
@@ -227,6 +227,9 @@ permissions:
|
||||
lunachat-admin.japanize-other:
|
||||
description: 他者のjapanizeオンオフ設定コマンドの使用権限
|
||||
default: op
|
||||
lunachat-admin.force-invite:
|
||||
description: 強制入室コマンドの使用権限
|
||||
default: op
|
||||
lunachat-admin.*:
|
||||
children:
|
||||
lunachat-admin.mod-all-channels: true
|
||||
@@ -236,4 +239,5 @@ permissions:
|
||||
lunachat-admin.check: true
|
||||
lunachat-admin.reload: true
|
||||
lunachat-admin.japanize-other: true
|
||||
lunachat-admin.force-invite: true
|
||||
description: 管理者向けの全コマンドの使用権限
|
||||
新しいイシューから参照
ユーザーをブロックする