コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
b96d9566d0 | ||
|
|
1e384e9043 | ||
|
|
7c28c02736 | ||
|
|
274415a763 | ||
|
|
5f5a8c219f | ||
|
|
d403b16eda | ||
|
|
945a27034e | ||
|
|
d7f735c5ea | ||
|
|
9e3c5ec312 | ||
|
|
0866722243 | ||
|
|
a58830f314 | ||
|
|
6cdd8438f7 | ||
|
|
854abef1b3 |
検索条件に一致するファイルはありません
@@ -7,3 +7,4 @@
|
||||
*.iml
|
||||
/.sts4-cache
|
||||
/LunaChat
|
||||
/pom.xml.versionsBackup
|
||||
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.ucchyocean</groupId>
|
||||
<artifactId>LunaChat</artifactId>
|
||||
<version>3.0.10</version>
|
||||
<version>3.0.15</version>
|
||||
<description>A powerfull chat channel plugin with IME (Kana-Kanji conversion) support</description>
|
||||
<url>https://github.com/ucchyocean/LunaChat</url>
|
||||
|
||||
@@ -101,18 +101,23 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12.4</version>
|
||||
<configuration>
|
||||
<junitArtifactName>junit:junit</junitArtifactName>
|
||||
<encoding>UTF-8</encoding>
|
||||
<inputEncoding>UTF-8</inputEncoding>
|
||||
<outputEncoding>UTF-8</outputEncoding>
|
||||
<argLine>-Dfile.encoding=UTF-8</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12.4</version>
|
||||
<configuration>
|
||||
<junitArtifactName>junit:junit</junitArtifactName>
|
||||
<encoding>UTF-8</encoding>
|
||||
<inputEncoding>UTF-8</inputEncoding>
|
||||
<outputEncoding>UTF-8</outputEncoding>
|
||||
<argLine>-Dfile.encoding=UTF-8</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>versions-maven-plugin</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
@@ -158,7 +163,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
||||
<version>1.16.2-R0.1-SNAPSHOT</version>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
@@ -172,7 +177,7 @@
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-chat</artifactId>
|
||||
<version>1.16-R0.1</version>
|
||||
<version>1.16-R0.3</version>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
@@ -212,7 +217,7 @@
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.128</version>
|
||||
<version>2.1.145</version>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
@@ -241,7 +246,7 @@
|
||||
<dependency>
|
||||
<groupId>net.alpenblock</groupId>
|
||||
<artifactId>BungeePerms</artifactId>
|
||||
<version>4.0-dev-106</version>
|
||||
<version>4.0-dev-114</version>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
@@ -267,22 +272,22 @@
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.5</version>
|
||||
<version>2.8.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.9</version>
|
||||
<version>3.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>16.0.2</version>
|
||||
<version>20.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<version>4.13</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -40,7 +40,8 @@ public class BungeePermsBridge {
|
||||
* @return the full prefix; may be null
|
||||
*/
|
||||
public String userPrefix(String nameoruuid, String server, String world) {
|
||||
return BungeePermsAPI.userPrefix(nameoruuid, server, world);
|
||||
String prefix = BungeePermsAPI.userPrefix(nameoruuid, server, world);
|
||||
return (prefix != null) ? prefix : "";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,6 +52,7 @@ public class BungeePermsBridge {
|
||||
* @return the full suffix; may be null
|
||||
*/
|
||||
public String userSuffix(String nameoruuid, String server, String world) {
|
||||
return BungeePermsAPI.userSuffix(nameoruuid, server, world);
|
||||
String suffix = BungeePermsAPI.userSuffix(nameoruuid, server, world);
|
||||
return (suffix != null) ? suffix : "";
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,11 @@ public class MultiverseCoreBridge {
|
||||
|
||||
MultiverseWorld mvworld = mvc.getMVWorldManager().getMVWorld(worldName);
|
||||
if ( mvworld != null ) {
|
||||
return mvworld.getColoredWorldString();
|
||||
if ( mvworld.getAlias().length() > 0 ) {
|
||||
return mvworld.getAlias();
|
||||
} else {
|
||||
return mvworld.getName();
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -65,7 +69,11 @@ public class MultiverseCoreBridge {
|
||||
|
||||
MultiverseWorld mvworld = mvc.getMVWorldManager().getMVWorld(world);
|
||||
if ( mvworld != null ) {
|
||||
return mvworld.getColoredWorldString();
|
||||
if ( mvworld.getAlias().length() > 0 ) {
|
||||
return mvworld.getAlias();
|
||||
} else {
|
||||
return mvworld.getName();
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ public class VaultChatBridge {
|
||||
* @return プレイヤーのprefix
|
||||
*/
|
||||
public String getPlayerPrefix(Player player) {
|
||||
return chatPlugin.getPlayerPrefix(player);
|
||||
String prefix = chatPlugin.getPlayerPrefix(player);
|
||||
return (prefix != null) ? prefix : "";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,6 +59,7 @@ public class VaultChatBridge {
|
||||
* @return プレイヤーのsuffix
|
||||
*/
|
||||
public String getPlayerSuffix(Player player) {
|
||||
return chatPlugin.getPlayerSuffix(player);
|
||||
String suffix = chatPlugin.getPlayerSuffix(player);
|
||||
return (suffix != null) ? suffix : "";
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,8 @@ public class BukkitEventListener implements Listener {
|
||||
}
|
||||
|
||||
for ( Channel channel : deleteList ) {
|
||||
LunaChat.getAPI().removeChannel(channel.getName());
|
||||
LunaChat.getAPI().removeChannel(
|
||||
channel.getName(), ChannelMember.getChannelMember(player));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +287,7 @@ public class BukkitEventListener implements Listener {
|
||||
// グローバルチャンネルの取得、無ければ作成
|
||||
Channel global = api.getChannel(config.getGlobalChannel());
|
||||
if ( global == null ) {
|
||||
global = api.createChannel(config.getGlobalChannel());
|
||||
global = api.createChannel(config.getGlobalChannel(), player);
|
||||
}
|
||||
|
||||
String message = event.getMessage();
|
||||
@@ -450,7 +451,7 @@ public class BukkitEventListener implements Listener {
|
||||
// チャンネルが存在しない場合は作成する
|
||||
Channel global = api.getChannel(gcName);
|
||||
if ( global == null ) {
|
||||
global = api.createChannel(gcName);
|
||||
global = api.createChannel(gcName, ChannelMember.getChannelMember(player));
|
||||
}
|
||||
|
||||
// デフォルト発言先が無いなら、グローバルチャンネルに設定する
|
||||
@@ -478,7 +479,7 @@ public class BukkitEventListener implements Listener {
|
||||
// チャンネルが存在しない場合は作成する
|
||||
Channel channel = api.getChannel(cname);
|
||||
if ( channel == null ) {
|
||||
channel = api.createChannel(cname);
|
||||
channel = api.createChannel(cname, ChannelMember.getChannelMember(player));
|
||||
}
|
||||
|
||||
// チャンネルのメンバーでないなら、参加する
|
||||
|
||||
@@ -179,7 +179,8 @@ public class BungeeEventListener implements Listener {
|
||||
}
|
||||
|
||||
for ( Channel channel : deleteList ) {
|
||||
LunaChat.getAPI().removeChannel(channel.getName());
|
||||
LunaChat.getAPI().removeChannel(
|
||||
channel.getName(), ChannelMember.getChannelMember(player));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,8 +242,12 @@ public class BungeeEventListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
// 発言内容を処理する
|
||||
processChat(ChannelMember.getChannelMember(event.getSender()), event.getMessage());
|
||||
// 発言内容を非同期で処理する
|
||||
ProxyServer.getInstance().getScheduler().runAsync(LunaChatBungee.getInstance(), new Runnable() {
|
||||
public void run() {
|
||||
processChat(ChannelMember.getChannelMember(event.getSender()), event.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
// イベントをキャンセル
|
||||
event.setCancelled(true);
|
||||
@@ -319,7 +324,7 @@ public class BungeeEventListener implements Listener {
|
||||
// グローバルチャンネルの取得、無ければ作成
|
||||
Channel global = api.getChannel(config.getGlobalChannel());
|
||||
if ( global == null ) {
|
||||
global = api.createChannel(config.getGlobalChannel());
|
||||
global = api.createChannel(config.getGlobalChannel(), member);
|
||||
}
|
||||
|
||||
// デフォルト発言先が無いなら、グローバルチャンネルに設定する
|
||||
@@ -468,7 +473,7 @@ public class BungeeEventListener implements Listener {
|
||||
// チャンネルが存在しない場合は作成する
|
||||
Channel channel = api.getChannel(cname);
|
||||
if ( channel == null ) {
|
||||
channel = api.createChannel(cname);
|
||||
channel = api.createChannel(cname, ChannelMember.getChannelMember(player));
|
||||
}
|
||||
|
||||
// チャンネルのメンバーでないなら、参加する
|
||||
@@ -500,7 +505,7 @@ public class BungeeEventListener implements Listener {
|
||||
// チャンネルが存在しない場合は作成する
|
||||
Channel global = api.getChannel(gcName);
|
||||
if ( global == null ) {
|
||||
global = api.createChannel(gcName);
|
||||
global = api.createChannel(gcName, ChannelMember.getChannelMember(player));
|
||||
}
|
||||
|
||||
// デフォルト発言先が無いなら、グローバルチャンネルに設定する
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -66,57 +65,12 @@ public class BukkitChannel extends Channel {
|
||||
if ( isBroadcastChannel() ) {
|
||||
// ブロードキャストチャンネル
|
||||
|
||||
if ( isWorldRange() && player.isOnline() && player.getWorldName() != null ) {
|
||||
|
||||
World w = Bukkit.getWorld(player.getWorldName());
|
||||
|
||||
if ( getChatRange() > 0 ) {
|
||||
// 範囲チャット
|
||||
|
||||
if ( player instanceof ChannelMemberBukkit ) {
|
||||
// ↑常にtrueだと思うが、念のため。
|
||||
|
||||
Location origin = ((ChannelMemberBukkit)player).getLocation();
|
||||
for ( Player p : Bukkit.getOnlinePlayers() ) {
|
||||
ChannelMember cp = ChannelMember.getChannelMember(p);
|
||||
if ( p.getWorld().equals(w) &&
|
||||
origin.distance(p.getLocation()) <= getChatRange() &&
|
||||
!getHided().contains(cp) ) {
|
||||
recipients.add(ChannelMember.getChannelMember(p));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// ワールドチャット
|
||||
|
||||
for ( Player p : Bukkit.getOnlinePlayers() ) {
|
||||
ChannelMember cp = ChannelMember.getChannelMember(p);
|
||||
if ( p.getWorld().equals(w) && !getHided().contains(cp) ) {
|
||||
recipients.add(ChannelMember.getChannelMember(p));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 受信者が自分以外いない場合は、メッセージを表示する
|
||||
if ( Messages.noRecipientMessage("", "").length > 0 && (
|
||||
recipients.size() == 0 ||
|
||||
(recipients.size() == 1 &&
|
||||
recipients.get(0).getName().equals(player.getName()) ) ) ) {
|
||||
sendNoRecipientMessage = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
// 通常ブロードキャスト(全員へ送信)
|
||||
|
||||
for ( Player p : Bukkit.getOnlinePlayers() ) {
|
||||
ChannelMember cp = ChannelMember.getChannelMember(p);
|
||||
if ( !getHided().contains(cp) ) {
|
||||
recipients.add(cp);
|
||||
}
|
||||
for ( Player p : Bukkit.getOnlinePlayers() ) {
|
||||
ChannelMember cp = ChannelMember.getChannelMember(p);
|
||||
if ( !getHided().contains(cp) ) {
|
||||
recipients.add(cp);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// 通常チャンネル
|
||||
|
||||
@@ -127,6 +81,47 @@ public class BukkitChannel extends Channel {
|
||||
}
|
||||
}
|
||||
|
||||
if ( isWorldRange() && player.isOnline() && player.getWorldName() != null ) {
|
||||
// ワールドチャットや範囲チャットの場合は、範囲外のプレイヤーをrecipientsから抜く
|
||||
|
||||
List<ChannelMember> recipientsNew = new ArrayList<>();
|
||||
|
||||
if ( getChatRange() > 0 ) {
|
||||
// 範囲チャット
|
||||
|
||||
@Nullable Location origin = ((ChannelMemberBukkit)player).getLocation();
|
||||
for ( ChannelMember recipient : recipients ) {
|
||||
@Nullable Location target = ((ChannelMemberBukkit)recipient).getLocation();
|
||||
if ( origin != null && target != null &&
|
||||
origin.getWorld().equals(target.getWorld()) &&
|
||||
origin.distance(target) <= getChatRange() ) {
|
||||
recipientsNew.add(recipient);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// ワールドチャット
|
||||
|
||||
@Nullable World w = ((ChannelMemberBukkit)player).getWorld();
|
||||
for ( ChannelMember recipient : recipients ) {
|
||||
@Nullable World target = ((ChannelMemberBukkit)recipient).getWorld();
|
||||
if ( w != null && target != null && w.equals(target) ) {
|
||||
recipientsNew.add(recipient);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
recipients = recipientsNew;
|
||||
|
||||
// 受信者が自分以外いない場合は、メッセージを表示する
|
||||
if ( Messages.noRecipientMessage("", "").length > 0 && (
|
||||
recipients.size() == 0 ||
|
||||
(recipients.size() == 1 &&
|
||||
recipients.get(0).getName().equals(player.getName()) ) ) ) {
|
||||
sendNoRecipientMessage = true;
|
||||
}
|
||||
}
|
||||
|
||||
// opListenAllChannel 設定がある場合は、
|
||||
// パーミッション lunachat-admin.listen-all-channels を持つプレイヤーを
|
||||
// 受信者に加える。
|
||||
@@ -188,7 +183,7 @@ public class BukkitChannel extends Channel {
|
||||
|
||||
// 設定に応じて、コンソールに出力する
|
||||
if ( config.isDisplayChatOnConsole() ) {
|
||||
Bukkit.getLogger().info(ChatColor.stripColor(message));
|
||||
Bukkit.getLogger().info(message);
|
||||
}
|
||||
|
||||
// 受信者が自分以外いない場合は、メッセージを表示する
|
||||
|
||||
@@ -272,6 +272,8 @@ public abstract class Channel {
|
||||
// チャンネルで許可されていて、発言者がパーミッションを持っている場合に置き換える
|
||||
if ( isAllowCC() && player.hasPermission("lunachat.allowcc") ) {
|
||||
maskedMessage = Utility.replaceColorCode(maskedMessage);
|
||||
} else {
|
||||
maskedMessage = Utility.stripColorCode(maskedMessage);
|
||||
}
|
||||
|
||||
// LunaChatChannelChatEvent イベントコール
|
||||
|
||||
@@ -113,7 +113,7 @@ public class CreateCommand extends LunaChatSubCommand {
|
||||
}
|
||||
|
||||
// チャンネル作成
|
||||
Channel channel = api.createChannel(name);
|
||||
Channel channel = api.createChannel(name, sender);
|
||||
if ( channel != null ) {
|
||||
channel.setDescription(desc);
|
||||
channel.save();
|
||||
|
||||
@@ -141,7 +141,7 @@ public class JoinCommand extends LunaChatSubCommand {
|
||||
}
|
||||
|
||||
// チャンネル作成
|
||||
Channel c = api.createChannel(channelName);
|
||||
Channel c = api.createChannel(channelName, sender);
|
||||
if ( c != null ) {
|
||||
c.addMember(sender);
|
||||
sender.sendMessage(Messages.cmdmsgCreate(channelName));
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ListCommand extends LunaChatSubCommand {
|
||||
ChannelMember sender, String label, String[] args) {
|
||||
|
||||
int page = 1;
|
||||
if ( args.length >= 2 && args[1].matches("[0-9]") ) {
|
||||
if ( args.length >= 2 && args[1].matches("[0-9]+") ) {
|
||||
page = Integer.parseInt(args[1]);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
*/
|
||||
package com.github.ucchyocean.lc3.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.github.ucchyocean.lc3.LunaChat;
|
||||
import com.github.ucchyocean.lc3.LunaChatAPI;
|
||||
import com.github.ucchyocean.lc3.Messages;
|
||||
import com.github.ucchyocean.lc3.channel.Channel;
|
||||
import com.github.ucchyocean.lc3.member.ChannelMember;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 1:1チャット送信コマンド
|
||||
* @author ucchy
|
||||
@@ -86,7 +86,7 @@ public class LunaChatMessageCommand {
|
||||
Channel channel = api.getChannel(cname);
|
||||
if ( channel == null ) {
|
||||
// チャンネルを作成して、送信者、受信者をメンバーにする
|
||||
channel = api.createChannel(cname);
|
||||
channel = api.createChannel(cname, inviter);
|
||||
channel.setVisible(false);
|
||||
channel.addMember(inviter);
|
||||
channel.addMember(invited);
|
||||
|
||||
@@ -107,7 +107,7 @@ public class RemoveCommand extends LunaChatSubCommand {
|
||||
}
|
||||
|
||||
// チャンネル削除
|
||||
if ( api.removeChannel(cname) ) {
|
||||
if ( api.removeChannel(cname, sender) ) {
|
||||
sender.sendMessage(Messages.cmdmsgRemove(cname));
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -203,7 +203,7 @@ public class ClickableFormat {
|
||||
String text = matcher.group(2);
|
||||
String hover = matcher.group(3);
|
||||
String command = matcher.group(4);
|
||||
TextComponent tc = new TextComponent(text);
|
||||
TextComponent tc = new TextComponent(TextComponent.fromLegacyText(text));
|
||||
if ( !hover.isEmpty() ) {
|
||||
tc.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(hover).create()));
|
||||
@@ -213,6 +213,13 @@ public class ClickableFormat {
|
||||
} else { // type.equals("SUGGEST_COMMAND")
|
||||
tc.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command));
|
||||
}
|
||||
|
||||
// componentsの最後の要素のカラーコードを、TextComponentにも反映させる。 see issue #202
|
||||
if ( components.size() > 0 ) {
|
||||
BaseComponent last = components.get(components.size() - 1);
|
||||
tc.setColor(last.getColor());
|
||||
}
|
||||
|
||||
components.add(tc);
|
||||
|
||||
lastIndex = matcher.end();
|
||||
|
||||
@@ -29,9 +29,10 @@ public class KeywordReplacer {
|
||||
* @param value 値
|
||||
*/
|
||||
public void replace(String keyword, String value) {
|
||||
int start;
|
||||
while ( (start = str.indexOf(keyword)) > -1 ) {
|
||||
str.replace(start, start + keyword.length(), value);
|
||||
int index = 0;
|
||||
while ( (index = str.indexOf(keyword, index)) > -1 ) {
|
||||
str.replace(index, index + keyword.length(), value);
|
||||
index += value.length();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ public class Utility {
|
||||
}
|
||||
|
||||
/**
|
||||
* 文字列に含まれているカラーコード(§a)を除去して返す
|
||||
* 文字列に含まれているカラーコード(§a)やカラーコード候補(&aや#99AABB)を除去して返す
|
||||
* @param source 置き換え元の文字列
|
||||
* @return 置き換え後の文字列
|
||||
*/
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ChannelMemberDummy extends ChannelMember {
|
||||
*/
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return "うっちぃ";
|
||||
return "&aうっちぃ";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,11 +39,16 @@ public class ClickableFormatTest extends TestCase {
|
||||
|
||||
Messages.initialize(new File(MESSAGES_FOLDER), null, "ja");
|
||||
|
||||
String format = "&f[%color%ch&f]%prefix%displayname%suffix&a:&f %msg";
|
||||
//String format = "&f[%color%ch&f]%prefix%displayname%suffix&a:&f %msg";
|
||||
String format = "&7[%color%ch&7]%prefix%username: &f%msg";
|
||||
String jpFormat = "%japanize&7 $%msg";
|
||||
|
||||
ChannelMember member = new ChannelMemberDummy();
|
||||
Channel channel = new StandaloneChannel("r");
|
||||
channel.setColorCode(ChatColor.AQUA.toString());
|
||||
|
||||
ClickableFormat f = ClickableFormat.makeFormat(format, member, channel, true);
|
||||
f.replace("%msg", jpFormat);
|
||||
|
||||
System.out.println("pre = " + f.toString() + ", legacy text = " + f.toLegacyText());
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public class KeywordReplacerTest extends TestCase {
|
||||
|
||||
private static final int MAX = 10;
|
||||
|
||||
public void test() {
|
||||
public void testSpeedOfReplacement() {
|
||||
|
||||
String testee = "";
|
||||
for ( int i=1; i<=MAX; i++ ) {
|
||||
@@ -42,4 +42,32 @@ public class KeywordReplacerTest extends TestCase {
|
||||
|
||||
assertTrue(test1.equals(test2.toString()));
|
||||
}
|
||||
|
||||
public void testSafetyOfRecursiveReplacement() {
|
||||
|
||||
String testee = "%prefix%username&f: %msg";
|
||||
String keyword = "%msg";
|
||||
String val1 = "&f%japanize&7 #%msg";
|
||||
//String val2 = "発言の内容";
|
||||
String val2 = "%msg発%msg言%msgの%msg内%msg容%msg";
|
||||
|
||||
|
||||
KeywordReplacer test1 = new KeywordReplacer(testee);
|
||||
long start = System.currentTimeMillis();
|
||||
test1.replace(keyword, val1);
|
||||
test1.replace(keyword, val2);
|
||||
long time = System.currentTimeMillis() - start;
|
||||
System.out.println("test1 time = " + time + ", str = " + test1.toString());
|
||||
|
||||
|
||||
String test2 = new String(testee);
|
||||
start = System.currentTimeMillis();
|
||||
test2 = test2.replace(keyword, val1);
|
||||
test2 = test2.replace(keyword, val2);
|
||||
time = System.currentTimeMillis() - start;
|
||||
System.out.println("test2 time = " + time + ", str = " + test2);
|
||||
|
||||
|
||||
assertTrue(test1.toString().equals(test2));
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする