From b8d2d060dc3f88ff78a344d8ee52311d8a1c24c1 Mon Sep 17 00:00:00 2001 From: CarmJos Date: Fri, 18 Feb 2022 20:17:05 +0800 Subject: [PATCH] =?UTF-8?q?[1.2.1]=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=E9=87=8D=E8=BD=BD=E6=8C=87?= =?UTF-8?q?=E4=BB=A4=E3=80=82=20-=20[U]=20=E4=BB=A4=E6=96=B9=E5=9D=97?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=A3=80=E6=B5=8B=E6=9B=B4=E5=8A=A0=E5=AE=BD?= =?UTF-8?q?=E6=9D=BE=E3=80=82=20-=20[F]=20=E4=BF=AE=E5=A4=8D=E9=9D=9E?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6=E7=A6=BB=E5=BC=80=E6=B8=B8=E6=88=8F=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E6=95=B0=E6=8D=AE=E4=B8=8D=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../java/cc/carm/plugin/moeteleport/Main.java | 7 ++++-- .../command/MoeTeleportCommand.java | 23 +++++++++++++++++++ .../moeteleport/manager/TeleportManager.java | 3 +-- src/main/resources/messages.yml | 14 +++++------ src/main/resources/plugin.yml | 9 ++++++++ 6 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 src/main/java/cc/carm/plugin/moeteleport/command/MoeTeleportCommand.java diff --git a/pom.xml b/pom.xml index 092eebd..dd3017f 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ cc.carm.plugin moeteleport - 2.0.0 + 1.2.1 MoeTeleport 喵喵传送,简单的传送、设置家的插件。 diff --git a/src/main/java/cc/carm/plugin/moeteleport/Main.java b/src/main/java/cc/carm/plugin/moeteleport/Main.java index 5e4b217..32cf6a7 100644 --- a/src/main/java/cc/carm/plugin/moeteleport/Main.java +++ b/src/main/java/cc/carm/plugin/moeteleport/Main.java @@ -13,7 +13,6 @@ import cc.carm.plugin.moeteleport.listener.UserListener; import cc.carm.plugin.moeteleport.manager.ConfigManager; import cc.carm.plugin.moeteleport.manager.RequestManager; -import cc.carm.plugin.moeteleport.manager.TeleportManager; import cc.carm.plugin.moeteleport.manager.UserManager; import cc.carm.plugin.moeteleport.model.UserData; import cc.carm.plugin.moeteleport.util.ColorParser; @@ -32,7 +31,6 @@ public class Main extends JavaPlugin { public static boolean debugMode = true; private static Main instance; private UserManager userManager; - private TeleportManager teleportManager; private RequestManager requestManager; /** @@ -132,8 +130,13 @@ public void onDisable() { log(getName() + " " + getDescription().getVersion() + " 开始卸载..."); long startTime = System.currentTimeMillis(); + log("关闭所有请求..."); getRequestManager().shutdown(); + log("保存用户数据..."); + getUserManager().getUserDataMap().values().forEach(UserData::save); + getUserManager().getUserDataMap().clear(); + log("卸载监听器..."); Bukkit.getServicesManager().unregisterAll(this); diff --git a/src/main/java/cc/carm/plugin/moeteleport/command/MoeTeleportCommand.java b/src/main/java/cc/carm/plugin/moeteleport/command/MoeTeleportCommand.java new file mode 100644 index 0000000..f8113dc --- /dev/null +++ b/src/main/java/cc/carm/plugin/moeteleport/command/MoeTeleportCommand.java @@ -0,0 +1,23 @@ +package cc.carm.plugin.moeteleport.command; + +import cc.carm.plugin.moeteleport.manager.ConfigManager; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.jetbrains.annotations.NotNull; + +public class MoeTeleportCommand implements CommandExecutor { + + @Override + public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, + @NotNull String s, @NotNull String[] args) { + if (args[0].equalsIgnoreCase("reload")) { + commandSender.sendMessage("Reloading config..."); + ConfigManager.reload(); + commandSender.sendMessage("Config reloaded."); + return true; + } + return false; + } + +} diff --git a/src/main/java/cc/carm/plugin/moeteleport/manager/TeleportManager.java b/src/main/java/cc/carm/plugin/moeteleport/manager/TeleportManager.java index dd2ee01..5b10cdb 100644 --- a/src/main/java/cc/carm/plugin/moeteleport/manager/TeleportManager.java +++ b/src/main/java/cc/carm/plugin/moeteleport/manager/TeleportManager.java @@ -53,8 +53,7 @@ public static boolean isSafeLocation(Location location) { return false; // not transparent (will suffocate) } Block ground = leg.getRelative(BlockFace.DOWN); - return ground.getType().isSolid() - && !PluginConfig.DANGEROUS_TYPES.get().contains(ground.getType().name()); + return !PluginConfig.DANGEROUS_TYPES.get().contains(ground.getType().name()); } diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index a53b540..2d29a59 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[同意] &f输入 &5/tpaccept &f同意该请求。" - - "&c&l[拒绝] &f输入 &5/tpdeny &f拒绝该请求。" + - "&a&l[command=/tpAccept %(player)][同意][/command] &f输入 &5/tpaccept &f同意该请求。" + - "&c&l[command=/tpDeny %(player)][拒绝][/command] &f输入 &5/tpdeny &f拒绝该请求。" tpahere: - "&d%(player) &f请求传送您到Ta身边,您有 &5%(expire)秒 &f的时间回应。" - - "&a&l[同意] &f输入 &5/tpaccept &f同意该请求。" - - "&c&l[拒绝] &f输入 &5/tpdeny &f拒绝该请求。" + - "&a&l[command=/tpAccept %(player)][同意][/command] &f输入 &5/tpaccept &f同意该请求。" + - "&c&l[command=/tpDeny %(player)][拒绝][/command] &f输入 &5/tpdeny &f拒绝该请求。" tpaccept: - "&f您同意了 &d%(player) &f的传送请求。" tpdeny: @@ -38,7 +38,7 @@ no-request-player: - "&f您当前没有收到来自 &d%(player) &f的传送请求。" multi-requests: - "&f您当前有&d%(num)条请求&f待处理,请输入 &5/%(command) <玩家名> &f决定回应谁的请求。" - - "&f您也可以再次输入 &5/%(command) &f直接回应最近的一条请求。" + - "&f您也可以再次输入 &5/%(command) &f快速回应最近的一条请求。" request-sent-timeout: - "&f发往 &d%(player) &f的传送请求已超时。" request-received-timeout: @@ -48,13 +48,13 @@ teleporting: dangerous: - "&f目标地点不安全,传送被取消。" dangerous-here: - - "&f当前地点不安全,无法发送传送请求。" + - "&f当前地点不安全,传送被取消。" notAvailable: - "&f目标地点暂时无法前往,传送被取消。" home-list-header: - "&f您当前设定的所有家:" -home-list-object: "&8#&f%(id) &d%(location)" +home-list-object: "&8# &f%(id) &d%(location) &7[command=/home %(id)]✈[/command]" home-not-found: - "&f您还没有设置这个家,请先输入 &5/setHome <家名称> &f设置一个吧!" home-set: diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 5b83806..0f0e0a3 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -13,7 +13,16 @@ permissions: description: "插件的主权限节点" default: false + "MoeTeleport.admin": + description: "插件的管理员权限节点" + default: op + commands: + "MoeTeleport": + description: "插件的主命令,用于重载插件或查看插件信息。" + permission: "MoeTeleport.admin" + usage: "/MoeTeleport reload" + "back": description: 返回传送前的上一个地点。