diff --git a/pom.xml b/pom.xml
index 2233bb7..0e811ce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,10 +92,16 @@
http://nexus.theyeticave.net/content/repositories/pub_releases
- dynmap-repo
- mikeprimm repository
+ mikeprimm-repo
+ Dynmap repository
http://repo.mikeprimm.com/
+
+ onarandombox-repo
+ Multiverse repository
+ http://repo.onarandombox.com/content/groups/public
+
+
spigot-repo
Spigot Maven Repository
@@ -126,5 +132,10 @@
system
${basedir}/lib/HawkEye.jar
+
+ com.onarandombox.multiversecore
+ Multiverse-Core
+ 2.5
+
\ No newline at end of file
diff --git a/src/main/java/com/github/ucchyocean/lc/LunaChat.java b/src/main/java/com/github/ucchyocean/lc/LunaChat.java
index aa7b0f2..833c512 100644
--- a/src/main/java/com/github/ucchyocean/lc/LunaChat.java
+++ b/src/main/java/com/github/ucchyocean/lc/LunaChat.java
@@ -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
diff --git a/src/main/java/com/github/ucchyocean/lc/PlayerListener.java b/src/main/java/com/github/ucchyocean/lc/PlayerListener.java
index 2ca20ac..a1233b7 100644
--- a/src/main/java/com/github/ucchyocean/lc/PlayerListener.java
+++ b/src/main/java/com/github/ucchyocean/lc/PlayerListener.java
@@ -408,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);
diff --git a/src/main/java/com/github/ucchyocean/lc/bridge/MultiverseCoreBridge.java b/src/main/java/com/github/ucchyocean/lc/bridge/MultiverseCoreBridge.java
new file mode 100644
index 0000000..7f2ec72
--- /dev/null
+++ b/src/main/java/com/github/ucchyocean/lc/bridge/MultiverseCoreBridge.java
@@ -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;
+ }
+ }
+}
diff --git a/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java b/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java
index c93c2d4..9db3585 100644
--- a/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java
+++ b/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java
@@ -703,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 {
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 60e9b0f..5dbaf82 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -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: