From 9ee18d0f3ce61a55fbe03576e260c411e34c7e73 Mon Sep 17 00:00:00 2001 From: CarmJos Date: Fri, 18 Feb 2022 20:44:26 +0800 Subject: [PATCH] =?UTF-8?q?[2.0.0]=20=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20-=20[A]=20=E6=B7=BB=E5=8A=A0=E6=B6=88=E6=81=AF=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E6=89=A7=E8=A1=8C=E5=8A=9F=E8=83=BD(=E5=9F=BA?= =?UTF-8?q?=E4=BA=8EMineDown=E5=AE=9E=E7=8E=B0)=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++++- pom.xml | 20 ++++++++++++++++++- .../java/cc/carm/plugin/moeteleport/Main.java | 3 +++ .../plugin/moeteleport/util/MessageUtil.java | 3 ++- src/main/resources/messages.yml | 10 +++++----- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5cbfbc8..e87cb0b 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ ## [依赖](https://github.com/CarmJos/MoeTeleport/network/dependencies) - **[必须]** 插件本体基于 [Spigot-API](https://hub.spigotmc.org/stash/projects/SPIGOT) 、[BukkitAPI](http://bukkit.org/) 实现。 +- **[自带]** 消息格式基于 [MineDown](https://github.com/Phoenix616/MineDown) 实现。 + - 所有 messages.yml 均支持 MineDown 语法。 - **[推荐]** 变量部分基于 [PlaceholderAPI](https://www.spigotmc.org/resources/6245/) 实现。 详细依赖列表可见 [Dependencies](https://github.com/CarmJos/MoeTeleport/network/dependencies) 。 @@ -64,7 +66,9 @@ ### 消息配置文件 ([messages.yml](src/main/resources/messages.yml)) -详见源文件。 +支持 [MineDown 语法](https://wiki.phoenix616.dev/library:minedown:syntax),详见源文件。 + + ### 玩家数据配置文件 (data/\.yml) diff --git a/pom.xml b/pom.xml index dd3017f..0cde1c5 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ cc.carm.plugin moeteleport - 1.2.1 + 2.0.0 MoeTeleport 喵喵传送,简单的传送、设置家的插件。 @@ -71,6 +71,11 @@ https://repo1.maven.org/maven2/ + + minebench-repo + https://repo.minebench.de/ + + github GitHub Packages @@ -103,6 +108,13 @@ provided + + de.themoep + minedown + 1.7.1-SNAPSHOT + compile + + junit junit @@ -176,6 +188,12 @@ + + + de.themoep.minedown + cc.carm.plugin.moeteleport.lib.minedown + + diff --git a/src/main/java/cc/carm/plugin/moeteleport/Main.java b/src/main/java/cc/carm/plugin/moeteleport/Main.java index 32cf6a7..e5eaf07 100644 --- a/src/main/java/cc/carm/plugin/moeteleport/Main.java +++ b/src/main/java/cc/carm/plugin/moeteleport/Main.java @@ -1,6 +1,7 @@ package cc.carm.plugin.moeteleport; import cc.carm.plugin.moeteleport.command.BackCommand; +import cc.carm.plugin.moeteleport.command.MoeTeleportCommand; import cc.carm.plugin.moeteleport.command.completer.HomeNameCompleter; import cc.carm.plugin.moeteleport.command.completer.PlayerNameCompleter; import cc.carm.plugin.moeteleport.command.completer.TpRequestCompleter; @@ -109,6 +110,8 @@ public void onEnable() { regListener(new UserListener()); log("注册指令..."); + registerCommand("MoeTeleport", new MoeTeleportCommand()); + registerCommand("back", new BackCommand()); registerCommand("home", new GoHomeCommand(), new HomeNameCompleter()); diff --git a/src/main/java/cc/carm/plugin/moeteleport/util/MessageUtil.java b/src/main/java/cc/carm/plugin/moeteleport/util/MessageUtil.java index 5651202..ba5a6a2 100644 --- a/src/main/java/cc/carm/plugin/moeteleport/util/MessageUtil.java +++ b/src/main/java/cc/carm/plugin/moeteleport/util/MessageUtil.java @@ -1,5 +1,6 @@ package cc.carm.plugin.moeteleport.util; +import de.themoep.minedown.MineDown; import me.clip.placeholderapi.PlaceholderAPI; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -17,7 +18,7 @@ public static boolean hasPlaceholderAPI() { public static void send(@Nullable CommandSender sender, List messages) { if (messages == null || messages.isEmpty() || sender == null) return; for (String s : messages) { - sender.sendMessage(ColorParser.parse(s)); + sender.spigot().sendMessage(MineDown.parse(s)); } } diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 2d29a59..6dcf4b9 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -8,12 +8,12 @@ not-online: - "&f目标玩家并不在线,无法发送请求。" tpa: - "&d%(player) &f请求传送到您身边,您有 &5%(expire)秒 &f的时间回应。" - - "&a&l[command=/tpAccept %(player)][同意][/command] &f输入 &5/tpaccept &f同意该请求。" - - "&c&l[command=/tpDeny %(player)][拒绝][/command] &f输入 &5/tpdeny &f拒绝该请求。" + - "[&a&l[同意]](show_text=点击同意请求 run_command=/tpAccept %(player)) &f输入 &5/tpAccept &f同意该请求。" + - "[&c&l[拒绝]](show_text=点击拒绝请求 run_command=/tpDeny %(player)) &f输入 &5/tpDeny &f拒绝该请求。" tpahere: - "&d%(player) &f请求传送您到Ta身边,您有 &5%(expire)秒 &f的时间回应。" - - "&a&l[command=/tpAccept %(player)][同意][/command] &f输入 &5/tpaccept &f同意该请求。" - - "&c&l[command=/tpDeny %(player)][拒绝][/command] &f输入 &5/tpdeny &f拒绝该请求。" + - "[&a&l[同意]](show_text=点击同意请求 run_command=/tpAccept %(player)) &f输入 &5/tpAccept &f同意该请求。" + - "[&c&l[拒绝]](show_text=点击拒绝请求 run_command=/tpDeny %(player)) &f输入 &5/tpDeny &f拒绝该请求。" tpaccept: - "&f您同意了 &d%(player) &f的传送请求。" tpdeny: @@ -54,7 +54,7 @@ notAvailable: home-list-header: - "&f您当前设定的所有家:" -home-list-object: "&8# &f%(id) &d%(location) &7[command=/home %(id)]✈[/command]" +home-list-object: "&8# &f%(id) &d%(location) [&7✈](show_text=点击返回家 %(id) run_command=/home %(id))" home-not-found: - "&f您还没有设置这个家,请先输入 &5/setHome <家名称> &f设置一个吧!" home-set: