mcMMO 2.3のチャットAPIへ合わせる
このコミットが含まれているのは:
2ファイル変更
+34
-64
検索条件に一致するファイルはありません
@@ -112,6 +112,11 @@
|
||||
<name>CodeMC Repository</name>
|
||||
<url>https://repo.codemc.org/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>neetgames-repo</id>
|
||||
<name>mcMMO repository</name>
|
||||
<url>https://nexus.neetgames.com/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>md5-repo</id>
|
||||
<name>MD5 repository</name>
|
||||
@@ -170,29 +175,13 @@
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.146</version>
|
||||
<version>2.3.001</version>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.maven.scm</groupId>
|
||||
<artifactId>maven-scm-provider-gitexe</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-legacy</artifactId>
|
||||
<groupId>*</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
@@ -10,19 +10,19 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.github.ucchyocean.lc3.LunaChat;
|
||||
import com.github.ucchyocean.lc3.LunaChatAPI;
|
||||
import com.github.ucchyocean.lc3.LunaChatBukkit;
|
||||
import com.github.ucchyocean.lc3.LunaChatConfig;
|
||||
import com.github.ucchyocean.lc3.bukkit.BukkitRecipientChatJapanizeTask;
|
||||
import com.github.ucchyocean.lc3.japanize.JapanizeType;
|
||||
import com.github.ucchyocean.lc3.member.ChannelMember;
|
||||
import com.github.ucchyocean.lc3.util.Utility;
|
||||
import com.gmail.nossr50.api.PartyAPI;
|
||||
import com.gmail.nossr50.chat.author.Author;
|
||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
|
||||
/**
|
||||
@@ -38,13 +38,17 @@ public class McMMOBridge implements Listener {
|
||||
@EventHandler
|
||||
public void onMcMMOPartyChatEvent(McMMOPartyChatEvent event) {
|
||||
|
||||
// mcMMOから、パーティのメンバーを取得する
|
||||
List<Player> recipients = PartyAPI.getOnlineMembers(event.getParty());
|
||||
Author author = event.getAuthor();
|
||||
if ( !author.isPlayer() ) return;
|
||||
Player sender = Bukkit.getPlayer(author.uuid());
|
||||
if ( sender == null ) return;
|
||||
|
||||
String message = event.getMessage();
|
||||
ChannelMember player = ChannelMember.getChannelMember(event.getSender());
|
||||
// mcMMOから、パーティのメンバーを取得する
|
||||
List<Player> recipients = event.getAuthorParty().getOnlineMembers();
|
||||
|
||||
String message = event.getRawMessage();
|
||||
ChannelMember player = ChannelMember.getChannelMember(sender);
|
||||
LunaChatConfig config = LunaChat.getConfig();
|
||||
LunaChatAPI api = LunaChat.getAPI();
|
||||
|
||||
// NGワード発言をマスク
|
||||
for ( Pattern pattern : config.getNgwordCompiled() ) {
|
||||
@@ -63,53 +67,30 @@ public class McMMOBridge implements Listener {
|
||||
}
|
||||
|
||||
// 一時的にJapanizeスキップ設定かどうかを確認する
|
||||
boolean skipJapanize = false;
|
||||
String marker = config.getNoneJapanizeMarker();
|
||||
if ( !marker.equals("") && message.startsWith(marker) ) {
|
||||
skipJapanize = true;
|
||||
message = message.substring(marker.length());
|
||||
return;
|
||||
}
|
||||
|
||||
// 2byteコードを含むなら、Japanize変換は行わない
|
||||
String kanaTemp = Utility.stripColorCode(message);
|
||||
if ( !skipJapanize &&
|
||||
( kanaTemp.getBytes(StandardCharsets.UTF_8).length > kanaTemp.length() ||
|
||||
kanaTemp.matches("[ \\uFF61-\\uFF9F]+") ) ) {
|
||||
skipJapanize = true;
|
||||
if ( kanaTemp.getBytes(StandardCharsets.UTF_8).length > kanaTemp.length() ||
|
||||
kanaTemp.matches("[ \\uFF61-\\uFF9F]+") ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Japanize変換と、発言処理
|
||||
if ( !skipJapanize &&
|
||||
LunaChat.getAPI().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());
|
||||
|
||||
BukkitRecipientChatJapanizeTask task = new BukkitRecipientChatJapanizeTask(
|
||||
message, config.getJapanizeType(), player, taskFormat, recipients);
|
||||
|
||||
// 発言処理を必ず先に実施させるため、遅延を入れてタスクを実行する。
|
||||
int wait = config.getJapanizeWait();
|
||||
task.runTaskLater(LunaChatBukkit.getInstance(), wait);
|
||||
}
|
||||
if ( !LunaChat.getAPI().isPlayerJapanize(player.getName()) ||
|
||||
config.getJapanizeType() == JapanizeType.NONE ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 発言内容の設定
|
||||
event.setMessage(message);
|
||||
String taskFormat = Utility.replaceColorCode(config.getJapanizeLine2Format());
|
||||
|
||||
BukkitRecipientChatJapanizeTask task = new BukkitRecipientChatJapanizeTask(
|
||||
message, config.getJapanizeType(), player, taskFormat, recipients);
|
||||
|
||||
// 発言処理を必ず先に実施させるため、遅延を入れてタスクを実行する。
|
||||
int wait = config.getJapanizeWait();
|
||||
task.runTaskLater(LunaChatBukkit.getInstance(), wait);
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする