コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
3c35001148 | ||
|
|
397f92c825 |
検索条件に一致するファイルはありません
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.ucchyocean</groupId>
|
||||
<artifactId>LunaChat</artifactId>
|
||||
<version>2.7.8</version>
|
||||
<version>2.7.9</version>
|
||||
<description>チャンネルチャットプラグイン</description>
|
||||
|
||||
<licenses>
|
||||
@@ -101,7 +101,11 @@
|
||||
<name>Multiverse repository</name>
|
||||
<url>http://repo.onarandombox.com/content/groups/public</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>drtshock-releases</id>
|
||||
<name>mcMMO repository</name>
|
||||
<url>https://ci.drtshock.net/plugin/repository/everything</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<name>Spigot Maven Repository</name>
|
||||
@@ -137,5 +141,10 @@
|
||||
<artifactId>Multiverse-Core</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>1.5.04-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -16,6 +16,7 @@ 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.McMMOBridge;
|
||||
import com.github.ucchyocean.lc.bridge.MultiverseCoreBridge;
|
||||
import com.github.ucchyocean.lc.bridge.VaultChatBridge;
|
||||
import com.github.ucchyocean.lc.channel.ChannelManager;
|
||||
@@ -65,7 +66,7 @@ public class LunaChat extends JavaPlugin {
|
||||
manager.removeAllDefaultChannels();
|
||||
}
|
||||
|
||||
// Chat Plugin のロード
|
||||
// Vault のロード
|
||||
Plugin temp = getServer().getPluginManager().getPlugin("Vault");
|
||||
if ( temp != null ) {
|
||||
vaultchat = VaultChatBridge.load(temp);
|
||||
@@ -91,6 +92,11 @@ public class LunaChat extends JavaPlugin {
|
||||
multiverse = MultiverseCoreBridge.load(temp);
|
||||
}
|
||||
|
||||
// mcMMOのロード
|
||||
if ( getServer().getPluginManager().isPluginEnabled("mcMMO") ) {
|
||||
getServer().getPluginManager().registerEvents(new McMMOBridge(), this);
|
||||
}
|
||||
|
||||
// リスナーの登録
|
||||
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
|
||||
|
||||
|
||||
@@ -311,7 +311,6 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 一時的にJapanizeスキップ設定かどうかを確認する
|
||||
boolean skipJapanize = false;
|
||||
String marker = config.getNoneJapanizeMarker();
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* @author ucchy
|
||||
* @license LGPLv3
|
||||
* @copyright Copyright ucchy 2016
|
||||
*/
|
||||
package com.github.ucchyocean.lc.bridge;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.github.ucchyocean.lc.LunaChat;
|
||||
import com.github.ucchyocean.lc.LunaChatAPI;
|
||||
import com.github.ucchyocean.lc.LunaChatConfig;
|
||||
import com.github.ucchyocean.lc.Utility;
|
||||
import com.github.ucchyocean.lc.channel.ChannelPlayer;
|
||||
import com.github.ucchyocean.lc.channel.DelayedJapanizeRecipientChatTask;
|
||||
import com.github.ucchyocean.lc.japanize.JapanizeType;
|
||||
import com.gmail.nossr50.api.PartyAPI;
|
||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
|
||||
/**
|
||||
* mcMMO連携クラス
|
||||
* @author ucchy
|
||||
*/
|
||||
public class McMMOBridge implements Listener {
|
||||
|
||||
/**
|
||||
* mcMMOのパーティチャットが発生したときのイベント
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onMcMMOPartyChatEvent(McMMOPartyChatEvent event) {
|
||||
|
||||
// mcMMOから、パーティのメンバーを取得する
|
||||
List<Player> recipients = PartyAPI.getOnlineMembers(event.getParty());
|
||||
|
||||
String message = event.getMessage();
|
||||
ChannelPlayer player = ChannelPlayer.getChannelPlayer(event.getSender());
|
||||
LunaChatConfig config = LunaChat.getInstance().getLunaChatConfig();
|
||||
LunaChatAPI api = LunaChat.getInstance().getLunaChatAPI();
|
||||
|
||||
// NGワード発言をマスク
|
||||
for ( Pattern pattern : config.getNgwordCompiled() ) {
|
||||
Matcher matcher = pattern.matcher(message);
|
||||
if ( matcher.find() ) {
|
||||
message = matcher.replaceAll(
|
||||
Utility.getAstariskString(matcher.group(0).length()));
|
||||
}
|
||||
}
|
||||
|
||||
// カラーコード置き換え
|
||||
// 置き換え設定になっていて、発言者がパーミッションを持っているなら、置き換えする
|
||||
if ( config.isEnableNormalChatColorCode() &&
|
||||
player.hasPermission("lunachat.allowcc") ) {
|
||||
message = Utility.replaceColorCode(message);
|
||||
}
|
||||
|
||||
// 一時的にJapanizeスキップ設定かどうかを確認する
|
||||
boolean skipJapanize = false;
|
||||
String marker = config.getNoneJapanizeMarker();
|
||||
if ( !marker.equals("") && message.startsWith(marker) ) {
|
||||
skipJapanize = true;
|
||||
message = message.substring(marker.length());
|
||||
}
|
||||
|
||||
// 2byteコードを含むなら、Japanize変換は行わない
|
||||
String kanaTemp = Utility.stripColor(message);
|
||||
if ( !skipJapanize &&
|
||||
( kanaTemp.getBytes().length > kanaTemp.length() ||
|
||||
kanaTemp.matches("[ \\uFF61-\\uFF9F]+") ) ) {
|
||||
skipJapanize = true;
|
||||
}
|
||||
|
||||
// Japanize変換と、発言処理
|
||||
if ( !skipJapanize &&
|
||||
LunaChat.getInstance().getLunaChatAPI().isPlayerJapanize(player.getName()) &&
|
||||
config.getJapanizeType() != JapanizeType.NONE ) {
|
||||
|
||||
int lineType = config.getJapanizeDisplayLine();
|
||||
|
||||
if ( lineType == 1 ) {
|
||||
|
||||
String taskFormat = Utility.replaceColorCode(config.getJapanizeLine1Format());
|
||||
|
||||
String japanized = api.japanize(
|
||||
kanaTemp, config.getJapanizeType());
|
||||
if ( japanized != null ) {
|
||||
String temp = taskFormat.replace("%msg", message);
|
||||
message = temp.replace("%japanize", japanized);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
String taskFormat = Utility.replaceColorCode(config.getJapanizeLine2Format());
|
||||
|
||||
DelayedJapanizeRecipientChatTask task = new DelayedJapanizeRecipientChatTask(
|
||||
message, config.getJapanizeType(), player, taskFormat, recipients);
|
||||
|
||||
// 発言処理を必ず先に実施させるため、遅延を入れてタスクを実行する。
|
||||
int wait = config.getJapanizeWait();
|
||||
task.runTaskLater(LunaChat.getInstance(), wait);
|
||||
}
|
||||
}
|
||||
|
||||
// 発言内容の設定
|
||||
event.setMessage(message);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ package com.github.ucchyocean.lc.channel;
|
||||
import com.github.ucchyocean.lc.japanize.JapanizeType;
|
||||
|
||||
/**
|
||||
*
|
||||
* Japanize2行表示のときに、変換結果を遅延してチャンネルに表示するためのタスク
|
||||
* @author ucchy
|
||||
*/
|
||||
public class DelayedJapanizeChannelChatTask extends DelayedJapanizeConvertTask {
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.github.ucchyocean.lc.LunaChat;
|
||||
import com.github.ucchyocean.lc.japanize.JapanizeType;
|
||||
|
||||
/**
|
||||
*
|
||||
* Japanize2行表示のときに、変換結果を遅延して通常チャットに表示するためのタスク
|
||||
* @author ucchy
|
||||
*/
|
||||
public class DelayedJapanizeNormalChatTask extends DelayedJapanizeConvertTask {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* @author ucchy
|
||||
* @license LGPLv3
|
||||
* @copyright Copyright ucchy 2016
|
||||
*/
|
||||
package com.github.ucchyocean.lc.channel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.github.ucchyocean.lc.japanize.JapanizeType;
|
||||
|
||||
/**
|
||||
* Japanize2行表示のときに、変換結果を遅延して指定した受信者に表示するためのタスク。
|
||||
* 他プラグインのチャンネル(mcMMOのパーティチャットや、TownyChatなど)に、Japanize変換結果を表示するために使用する。
|
||||
* @author ucchy
|
||||
*/
|
||||
public class DelayedJapanizeRecipientChatTask extends DelayedJapanizeConvertTask {
|
||||
|
||||
private List<Player> recipients;
|
||||
|
||||
/**
|
||||
* コンストラクタ
|
||||
* @param org 変換前の文字列
|
||||
* @param type 変換タイプ
|
||||
* @param player 発言したプレイヤー
|
||||
* @param japanizeFormat 変換後に発言するときの、発言フォーマット
|
||||
* @param recipients メッセージ受信者
|
||||
*/
|
||||
public DelayedJapanizeRecipientChatTask(String org, JapanizeType type, ChannelPlayer player,
|
||||
String japanizeFormat, List<Player> recipients) {
|
||||
super(org, type, null, player, japanizeFormat);
|
||||
this.recipients = recipients;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if ( runSync() ) {
|
||||
|
||||
String result = getResult();
|
||||
|
||||
// 送信
|
||||
for ( Player p : recipients ) {
|
||||
p.sendMessage(result);
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ main: com.github.ucchyocean.lc.LunaChat
|
||||
version: ${project.version}
|
||||
author: ucchy
|
||||
description: ${project.description}
|
||||
softdepend: [Vault, dynmap, HawkEye, Multiverse-Core]
|
||||
softdepend: [Vault, dynmap, HawkEye, Multiverse-Core, mcMMO]
|
||||
|
||||
commands:
|
||||
lunachat:
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする