From c974c98a195a16d2793e9f44b2040e4e4b05247e Mon Sep 17 00:00:00 2001 From: 502647092 Date: Sat, 30 Jan 2016 21:03:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=83=A8=E5=88=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- .../java/cn/citycraft/VbariableAPI/VAPI.java | 13 +++++++ .../citycraft/VbariableAPI/VariableHook.java | 2 +- .../VbariableAPI/VariableReplaceEvent.java | 34 +++++++++++++++++++ .../citycraft/VbariableAPI/VbariableAPI.java | 18 ++++++++-- 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 src/main/java/cn/citycraft/VbariableAPI/VAPI.java diff --git a/src/main/java/cn/citycraft/VbariableAPI/VAPI.java b/src/main/java/cn/citycraft/VbariableAPI/VAPI.java new file mode 100644 index 0000000..4581ed4 --- /dev/null +++ b/src/main/java/cn/citycraft/VbariableAPI/VAPI.java @@ -0,0 +1,13 @@ +/** + * + */ +package cn.citycraft.VbariableAPI; + +/** + * + * @since 2016年1月30日 上午9:29:54 + * @author 喵♂呜 + */ +public class VAPI { + +} diff --git a/src/main/java/cn/citycraft/VbariableAPI/VariableHook.java b/src/main/java/cn/citycraft/VbariableAPI/VariableHook.java index 85dcac5..30a45cf 100644 --- a/src/main/java/cn/citycraft/VbariableAPI/VariableHook.java +++ b/src/main/java/cn/citycraft/VbariableAPI/VariableHook.java @@ -10,5 +10,5 @@ package cn.citycraft.VbariableAPI; * @author 喵♂呜 */ public interface VariableHook { - public String onVariableReplace(); + public String onVariableReplace(VariableReplaceEvent vre); } diff --git a/src/main/java/cn/citycraft/VbariableAPI/VariableReplaceEvent.java b/src/main/java/cn/citycraft/VbariableAPI/VariableReplaceEvent.java index dc7cf63..b44a259 100644 --- a/src/main/java/cn/citycraft/VbariableAPI/VariableReplaceEvent.java +++ b/src/main/java/cn/citycraft/VbariableAPI/VariableReplaceEvent.java @@ -3,6 +3,8 @@ */ package cn.citycraft.VbariableAPI; +import org.bukkit.OfflinePlayer; +import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; @@ -14,6 +16,17 @@ import org.bukkit.event.HandlerList; public class VariableReplaceEvent extends Event { private static final HandlerList handlers = new HandlerList(); + private Player player = null; + private final OfflinePlayer offlinePlayer; + private final String message; + + public VariableReplaceEvent(final OfflinePlayer offlinePlayer, final String message) { + if (offlinePlayer != null && offlinePlayer.isOnline()) { + this.player = (Player) offlinePlayer; + } + this.offlinePlayer = offlinePlayer; + this.message = message; + } public static HandlerList getHandlerList() { return handlers; @@ -24,4 +37,25 @@ public class VariableReplaceEvent extends Event { return handlers; } + /** + * @return message + */ + public String getMessage() { + return message; + } + + /** + * @return offlinePlayer + */ + public OfflinePlayer getOfflinePlayer() { + return offlinePlayer; + } + + /** + * @return player + */ + public Player getPlayer() { + return player; + } + } diff --git a/src/main/java/cn/citycraft/VbariableAPI/VbariableAPI.java b/src/main/java/cn/citycraft/VbariableAPI/VbariableAPI.java index 4395c17..4700afb 100644 --- a/src/main/java/cn/citycraft/VbariableAPI/VbariableAPI.java +++ b/src/main/java/cn/citycraft/VbariableAPI/VbariableAPI.java @@ -3,12 +3,26 @@ */ package cn.citycraft.VbariableAPI; +import org.bukkit.plugin.java.JavaPlugin; + +import cn.citycraft.PluginHelper.config.FileConfig; + /** * VbariableAPI核心 - * + * * @since 2016年1月29日 上午9:25:31 * @author 喵♂呜 */ -public class VbariableAPI { +public class VbariableAPI extends JavaPlugin { + FileConfig config; + @Override + public void onEnable() { + + } + + @Override + public void onLoad() { + config = new FileConfig(this); + } }