コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
a7b28931e9 | ||
|
|
d3fa98509d | ||
|
|
42a9625595 | ||
|
|
aab06a502a |
検索条件に一致するファイルはありません
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.ucchyocean</groupId>
|
||||
<artifactId>LunaChat</artifactId>
|
||||
<version>2.7.5</version>
|
||||
<version>2.7.7</version>
|
||||
<description>チャンネルチャットプラグイン</description>
|
||||
|
||||
<licenses>
|
||||
@@ -92,10 +92,16 @@
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>dynmap-repo</id>
|
||||
<name>mikeprimm repository</name>
|
||||
<id>mikeprimm-repo</id>
|
||||
<name>Dynmap repository</name>
|
||||
<url>http://repo.mikeprimm.com/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>onarandombox-repo</id>
|
||||
<name>Multiverse repository</name>
|
||||
<url>http://repo.onarandombox.com/content/groups/public</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<name>Spigot Maven Repository</name>
|
||||
@@ -126,5 +132,10 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/HawkEye.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.onarandombox.multiversecore</groupId>
|
||||
<artifactId>Multiverse-Core</artifactId>
|
||||
<version>2.5</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.MultiverseCoreBridge;
|
||||
import com.github.ucchyocean.lc.bridge.VaultChatBridge;
|
||||
import com.github.ucchyocean.lc.channel.ChannelManager;
|
||||
import com.github.ucchyocean.lc.command.LunaChatCommand;
|
||||
@@ -37,6 +38,7 @@ public class LunaChat extends JavaPlugin {
|
||||
private VaultChatBridge vaultchat;
|
||||
private DynmapBridge dynmap;
|
||||
private HawkEyeBridge hawkeye;
|
||||
private MultiverseCoreBridge multiverse;
|
||||
|
||||
private ExpireCheckTask expireCheckerTask;
|
||||
private LunaChatLogger normalChatLogger;
|
||||
@@ -83,6 +85,12 @@ public class LunaChat extends JavaPlugin {
|
||||
hawkeye = new HawkEyeBridge(this);
|
||||
}
|
||||
|
||||
// MultiverseCore のロード
|
||||
temp = getServer().getPluginManager().getPlugin("Multiverse-Core");
|
||||
if ( temp != null ) {
|
||||
multiverse = MultiverseCoreBridge.load(temp);
|
||||
}
|
||||
|
||||
// リスナーの登録
|
||||
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
|
||||
|
||||
@@ -208,6 +216,14 @@ public class LunaChat extends JavaPlugin {
|
||||
return hawkeye;
|
||||
}
|
||||
|
||||
/**
|
||||
* MultiverseCore連携クラスを返す
|
||||
* @return MultiverseCoreBridge
|
||||
*/
|
||||
public MultiverseCoreBridge getMultiverseCore() {
|
||||
return multiverse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通常チャット用のロガーを返す
|
||||
* @return normalChatLogger
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
*/
|
||||
package com.github.ucchyocean.lc;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -39,6 +41,17 @@ public class PlayerListener implements Listener {
|
||||
private static final String LIST_ENDLINE = Resources.get("listEndLine");
|
||||
private static final String LIST_FORMAT = Resources.get("listFormat");
|
||||
|
||||
private SimpleDateFormat dateFormat;
|
||||
private SimpleDateFormat timeFormat;
|
||||
|
||||
/**
|
||||
* コンストラクタ
|
||||
*/
|
||||
public PlayerListener() {
|
||||
dateFormat = new SimpleDateFormat("yyyy/MM/dd");
|
||||
timeFormat = new SimpleDateFormat("HH:mm:ss");
|
||||
}
|
||||
|
||||
/**
|
||||
* プレイヤーのチャットごとに呼び出されるメソッド
|
||||
* @param event チャットイベント
|
||||
@@ -374,6 +387,13 @@ public class PlayerListener implements Listener {
|
||||
format = format.replace("%username", "%1$s");
|
||||
format = format.replace("%msg", "%2$s");
|
||||
|
||||
if ( format.contains("%date") ) {
|
||||
format = format.replace("%date", dateFormat.format(new Date()));
|
||||
}
|
||||
if ( format.contains("%time") ) {
|
||||
format = format.replace("%time", timeFormat.format(new Date()));
|
||||
}
|
||||
|
||||
if ( format.contains("%prefix") || format.contains("%suffix") ) {
|
||||
|
||||
String prefix = "";
|
||||
@@ -388,7 +408,15 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
if ( format.contains("%world") ) {
|
||||
format = format.replace("%world", player.getWorld().getName());
|
||||
|
||||
String worldname = null;
|
||||
if ( LunaChat.getInstance().getMultiverseCore() != null ) {
|
||||
worldname = LunaChat.getInstance().getMultiverseCore().getWorldAlias(player.getWorld());
|
||||
}
|
||||
if ( worldname == null || worldname.equals("") ) {
|
||||
worldname = player.getWorld().getName();
|
||||
}
|
||||
format = format.replace("%world", worldname);
|
||||
}
|
||||
|
||||
return Utility.replaceColorCode(format);
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* @author ucchy
|
||||
* @license LGPLv3
|
||||
* @copyright Copyright ucchy 2015
|
||||
*/
|
||||
package com.github.ucchyocean.lc.bridge;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.Core;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
|
||||
/**
|
||||
* MultiverseCore連携クラス
|
||||
* @author ucchy
|
||||
*/
|
||||
public class MultiverseCoreBridge {
|
||||
|
||||
/** MultiverseCore API クラス */
|
||||
private Core mvc;
|
||||
|
||||
/** コンストラクタは使用不可 */
|
||||
private MultiverseCoreBridge() {
|
||||
}
|
||||
|
||||
/**
|
||||
* MultiverseCore-apiをロードする
|
||||
* @param plugin MultiverseCoreのプラグインインスタンス
|
||||
* @param ロードしたかどうか
|
||||
*/
|
||||
public static MultiverseCoreBridge load(Plugin plugin) {
|
||||
|
||||
if ( plugin instanceof MultiverseCore ) {
|
||||
MultiverseCoreBridge bridge = new MultiverseCoreBridge();
|
||||
bridge.mvc = (Core)plugin;
|
||||
return bridge;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定されたワールドのエイリアス名を取得する
|
||||
* @param worldName ワールド名
|
||||
* @return エイリアス名、取得できない場合はnullが返される
|
||||
*/
|
||||
public String getWorldAlias(String worldName) {
|
||||
|
||||
MultiverseWorld mvworld = mvc.getMVWorldManager().getMVWorld(worldName);
|
||||
if ( mvworld != null ) {
|
||||
return mvworld.getAlias();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定されたワールドのエイリアス名を取得する
|
||||
* @param world ワールド
|
||||
* @return エイリアス名、取得できない場合はnullが返される
|
||||
*/
|
||||
public String getWorldAlias(World world) {
|
||||
|
||||
MultiverseWorld mvworld = mvc.getMVWorldManager().getMVWorld(world);
|
||||
if ( mvworld != null ) {
|
||||
return mvworld.getAlias();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,9 @@
|
||||
*/
|
||||
package com.github.ucchyocean.lc.channel;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -67,6 +69,9 @@ public class ChannelImpl extends Channel {
|
||||
|
||||
private static final String ERRMSG_MUTED = Resources.get("errmsgMuted");
|
||||
|
||||
private SimpleDateFormat dateFormat;
|
||||
private SimpleDateFormat timeFormat;
|
||||
|
||||
/** ロガー */
|
||||
private LunaChatLogger logger;
|
||||
|
||||
@@ -79,6 +84,8 @@ public class ChannelImpl extends Channel {
|
||||
super(name);
|
||||
|
||||
logger = new LunaChatLogger(name.replace(">", "-"));
|
||||
dateFormat = new SimpleDateFormat("yyyy/MM/dd");
|
||||
timeFormat = new SimpleDateFormat("HH:mm:ss");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -680,6 +687,13 @@ public class ChannelImpl extends Channel {
|
||||
msg = msg.replace("%color", getColorCode());
|
||||
msg = msg.replace("%to", getPrivateMessageTo());
|
||||
|
||||
if ( msg.contains("%date") ) {
|
||||
msg = msg.replace("%date", dateFormat.format(new Date()));
|
||||
}
|
||||
if ( msg.contains("%time") ) {
|
||||
msg = msg.replace("%time", timeFormat.format(new Date()));
|
||||
}
|
||||
|
||||
if ( player != null ) {
|
||||
msg = msg.replace("%username", player.getDisplayName());
|
||||
msg = msg.replace("%player", player.getName());
|
||||
@@ -689,8 +703,16 @@ public class ChannelImpl extends Channel {
|
||||
msg = msg.replace("%suffix", player.getSuffix());
|
||||
}
|
||||
|
||||
if ( msg.contains("%world") ) {
|
||||
msg = msg.replace("%world", player.getWorldName());
|
||||
if ( format.contains("%world") ) {
|
||||
|
||||
String worldname = null;
|
||||
if ( LunaChat.getInstance().getMultiverseCore() != null ) {
|
||||
worldname = LunaChat.getInstance().getMultiverseCore().getWorldAlias(player.getWorldName());
|
||||
}
|
||||
if ( worldname == null || worldname.equals("") ) {
|
||||
worldname = player.getWorldName();
|
||||
}
|
||||
format = format.replace("%world", worldname);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -151,4 +151,13 @@ public class IMEConverter {
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
// デバッグ用エントリ
|
||||
public static void main(String[] args) {
|
||||
String testee = "sonnnakotohanak(ry)";
|
||||
System.out.println("original : " + testee);
|
||||
System.out.println("kana : " + KanaConverter.conv(testee));
|
||||
System.out.println("GoogleIME : " + convByGoogleIME(KanaConverter.conv(testee)));
|
||||
System.out.println("SocialIME : " + convBySocialIME(KanaConverter.conv(testee)));
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,20 @@ public class KanaConverter {
|
||||
} else if ( tmp.equals("]") ) {
|
||||
line.append(last + "」");
|
||||
last = "";
|
||||
} else if ( tmp.equals("<") ) {
|
||||
line.append(last + "<");
|
||||
last = "";
|
||||
} else if ( tmp.equals(">") ) {
|
||||
line.append(last + ">");
|
||||
last = "";
|
||||
} else if ( tmp.equals("&") ) {
|
||||
line.append(last + "&");
|
||||
last = "";
|
||||
} else if ( tmp.equals("\"") ) {
|
||||
line.append(last + "”");
|
||||
last = "";
|
||||
} else if ( tmp.equals("(") || tmp.equals(")") ) {
|
||||
line.append(last);
|
||||
last = "";
|
||||
} else {
|
||||
line.append(last + tmp);
|
||||
|
||||
@@ -59,6 +59,8 @@ formatConstraint: ['%username', '%msg']
|
||||
# %world : 発言したワールド名
|
||||
# %prefix : プレフィックス(VaultとPermissionsExが導入されている場合に置き換えられます)
|
||||
# %suffix : サフィックス(VaultとPermissionsExが導入されている場合に置き換えられます)
|
||||
# %date : 日付
|
||||
# %time : 時刻
|
||||
# %msg : 発言内容(Japanize変換された場合は、Japanize結果を含みます。)
|
||||
defaultFormat: '&f[%color%ch&f]%prefix%username%suffix&a:&f %msg'
|
||||
|
||||
@@ -86,6 +88,8 @@ maxChannelNameLength: 20
|
||||
# %world : 発言したワールド名
|
||||
# %prefix : プレフィックス(VaultとPermissionsExが導入されている場合に置き換えられます)
|
||||
# %suffix : サフィックス(VaultとPermissionsExが導入されている場合に置き換えられます)
|
||||
# %date : 日付
|
||||
# %time : 時刻
|
||||
# %msg : 発言内容(Japanize変換された場合は、Japanize結果を含みます。)
|
||||
defaultFormatForPrivateMessage: '&7[%player -> %to]&f %msg'
|
||||
|
||||
@@ -140,6 +144,8 @@ enableNormalChatMessageFormat: true
|
||||
# %world : 発言したワールド名
|
||||
# %prefix : プレフィックス(VaultとPermissionsExが導入されている場合に置き換えられます)
|
||||
# %suffix : サフィックス(VaultとPermissionsExが導入されている場合に置き換えられます)
|
||||
# %date : 日付
|
||||
# %time : 時刻
|
||||
# %msg : 発言内容(Japanize変換された場合は、Japanize結果を含みます。)
|
||||
normalChatMessageFormat: '&f%prefix%username%suffix&a:&f %msg'
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ main: com.github.ucchyocean.lc.LunaChat
|
||||
version: ${project.version}
|
||||
author: ucchy
|
||||
description: ${project.description}
|
||||
softdepend: [Vault, dynmap, HawkEye]
|
||||
softdepend: [Vault, dynmap, HawkEye, Multiverse-Core]
|
||||
|
||||
commands:
|
||||
lunachat:
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする