From 440c4c9fa6ac6220e6c9ff34167324eadab394a3 Mon Sep 17 00:00:00 2001 From: zhangyuheng Date: Tue, 16 Jul 2024 14:16:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9D=83=E9=99=90=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E6=94=AF=E6=8C=81=EF=BC=8C=E7=A7=BB=E9=99=A4=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E7=9A=84commands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../cn/lunadeer/essentialsd/EssentialsD.java | 1 + .../lunadeer/essentialsd/commands/Apis.java | 71 +++--------- .../lunadeer/essentialsd/commands/Back.java | 4 - .../cn/lunadeer/essentialsd/commands/Day.java | 20 +--- .../essentialsd/commands/EnderChest.java | 4 - .../cn/lunadeer/essentialsd/commands/Fly.java | 9 +- .../cn/lunadeer/essentialsd/commands/God.java | 9 +- .../cn/lunadeer/essentialsd/commands/Hat.java | 5 - .../essentialsd/commands/Inspect.java | 10 +- .../lunadeer/essentialsd/commands/More.java | 12 +- .../lunadeer/essentialsd/commands/Night.java | 20 +--- .../lunadeer/essentialsd/commands/Noon.java | 21 +--- .../lunadeer/essentialsd/commands/Rain.java | 18 ++- .../cn/lunadeer/essentialsd/commands/Rtp.java | 4 - .../lunadeer/essentialsd/commands/Save.java | 4 - .../essentialsd/commands/ShowItem.java | 4 - .../lunadeer/essentialsd/commands/Skull.java | 5 - .../lunadeer/essentialsd/commands/Storm.java | 18 ++- .../essentialsd/commands/Suicide.java | 5 - .../cn/lunadeer/essentialsd/commands/Sun.java | 18 ++- .../cn/lunadeer/essentialsd/commands/Tpa.java | 6 +- .../essentialsd/commands/TpaHere.java | 49 ++++++++ .../essentialsd/commands/home/DelHome.java | 5 - .../essentialsd/commands/home/Home.java | 4 - .../essentialsd/commands/home/Homes.java | 6 - .../essentialsd/commands/home/SetHome.java | 4 - .../essentialsd/managers/ConfigManager.java | 56 --------- .../essentialsd/managers/TeleportManager.java | 109 ++++++++++++++---- src/main/resources/config.yml | 12 -- src/main/resources/plugin.yml | 95 ++++++++++++++- 31 files changed, 295 insertions(+), 315 deletions(-) create mode 100644 src/main/java/cn/lunadeer/essentialsd/commands/TpaHere.java diff --git a/pom.xml b/pom.xml index 495d7b1..d0975e8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cn.lunadeer EssentialsD - 1.22.1 + 2.0.0 jar EssentialsD diff --git a/src/main/java/cn/lunadeer/essentialsd/EssentialsD.java b/src/main/java/cn/lunadeer/essentialsd/EssentialsD.java index e405f18..d515fdb 100644 --- a/src/main/java/cn/lunadeer/essentialsd/EssentialsD.java +++ b/src/main/java/cn/lunadeer/essentialsd/EssentialsD.java @@ -65,6 +65,7 @@ public final class EssentialsD extends JavaPlugin { Objects.requireNonNull(Bukkit.getPluginCommand("showitem")).setExecutor(new ShowItem()); Objects.requireNonNull(Bukkit.getPluginCommand("skull")).setExecutor(new Skull()); Objects.requireNonNull(Bukkit.getPluginCommand("tpa")).setExecutor(new Tpa()); + Objects.requireNonNull(Bukkit.getPluginCommand("tpahere")).setExecutor(new TpaHere()); Objects.requireNonNull(Bukkit.getPluginCommand("rtp")).setExecutor(new Rtp()); Objects.requireNonNull(Bukkit.getPluginCommand("back")).setExecutor(new Back()); Objects.requireNonNull(Bukkit.getPluginCommand("home")).setExecutor(new Home()); diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Apis.java b/src/main/java/cn/lunadeer/essentialsd/commands/Apis.java index 72d1000..fdf2f6f 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Apis.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Apis.java @@ -2,7 +2,8 @@ package cn.lunadeer.essentialsd.commands; import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.minecraftpluginutils.Notification; -import cn.lunadeer.minecraftpluginutils.XLogger; +import cn.lunadeer.minecraftpluginutils.Scheduler; +import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -10,26 +11,6 @@ import java.util.List; import java.util.stream.Collectors; public class Apis { - /** - * 判断 CommandSender 是否为 OP 玩家 - * - * @param sender CommandSender - * @return 如果是 OP 玩家则返回 Player 对象,否则返回 null - */ - public static Player getIfOP(CommandSender sender) { - if (sender instanceof Player) { - Player player = (Player) sender; - if (!player.isOp()) { - XLogger.warn("玩家 %s 被拒绝执行命令", player.getName()); - Notification.warn(player, "你没有权限使用此命令"); - return null; - } - return player; - } - Notification.warn(sender, "只有玩家才能使用此命令"); - return null; - } - /** * 获取命令操作的玩家 如果没有指定玩家则返回命令发送者 * @@ -37,43 +18,27 @@ public class Apis { * @param args 命令参数 * @return 如果指定了玩家则返回玩家对象,否则返回命令发送者 */ - public static Player opCommandGetPlayer(CommandSender sender, String[] args) { - Player target; - if (args.length == 1) { - target = EssentialsD.instance.getServer().getPlayer(args[0]); - if (target == null) { - Notification.warn(sender, "玩家 %s 不在线", args[0]); - return null; - } - } else { - if (!(sender instanceof Player)) { - Notification.warn(sender, "请指定要操作的玩家"); - return null; - } - target = (Player) sender; + public static Player getPlayerFromArg(CommandSender sender, String[] args, int pos) { + Player target = EssentialsD.instance.getServer().getPlayer(args[pos]); + if (target == null) { + Notification.warn(sender, "玩家 %s 不在线", args[0]); + return null; } return target; } - /** - * 判断是否为 OP 玩家或控制台 - * - * @param sender 命令发送者 - * @return 如果是 OP 玩家或控制台则返回 true,否则返回 false - */ - public static boolean notOpOrConsole(CommandSender sender) { - if (sender instanceof Player) { - Player player = (Player) sender; - if (!player.isOp()) { - XLogger.warn("玩家 %s 被拒绝执行命令", player.getName()); - Notification.warn(player, "你没有权限使用此命令"); - return true; - } - } - return false; - } - public static List playerNames() { return EssentialsD.instance.getServer().getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList()); } + + public static void setOverWorldTime(CommandSender sender, long time) { + Scheduler.runTask(() -> { + EssentialsD.instance.getServer().getWorlds().forEach(world -> { + if (world.getEnvironment() == World.Environment.NORMAL) { + world.setTime(time); + Notification.info(sender, "设置 %s 时间为 %d", world.getName(), time); + } + }); + }); + } } diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Back.java b/src/main/java/cn/lunadeer/essentialsd/commands/Back.java index d1aa883..14b61d3 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Back.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Back.java @@ -18,10 +18,6 @@ public class Back implements TabExecutor { Notification.warn(sender, "只有玩家可以使用此命令"); return true; } - if (!EssentialsD.config.getCommandsBack()) { - Notification.error(sender, "这个命令已被管理员禁用"); - return false; - } Player player = (Player) sender; EssentialsD.tpManager.back(player); return true; diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Day.java b/src/main/java/cn/lunadeer/essentialsd/commands/Day.java index 4703cf2..83cb807 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Day.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Day.java @@ -1,15 +1,12 @@ package cn.lunadeer.essentialsd.commands; -import cn.lunadeer.essentialsd.EssentialsD; -import cn.lunadeer.minecraftpluginutils.Notification; -import cn.lunadeer.minecraftpluginutils.Scheduler; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import static cn.lunadeer.essentialsd.commands.Apis.notOpOrConsole; +import static cn.lunadeer.essentialsd.commands.Apis.setOverWorldTime; + public class Day implements CommandExecutor { /** @@ -26,19 +23,8 @@ public class Day implements CommandExecutor { */ @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { - if (notOpOrConsole(sender)) { - return false; - } // set time to 1000 - Scheduler.runTask(() -> { - if (sender instanceof Player) { - ((Player) sender).getWorld().setTime(1000); - Notification.info(sender, "设置 %s 时间为白天", ((Player) sender).getWorld().getName()); - } else { - EssentialsD.instance.getServer().getWorlds().forEach(world -> world.setTime(1000)); - Notification.info(sender, "设置时间为白天"); - } - }); + setOverWorldTime(sender, 1000); return true; } } diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/EnderChest.java b/src/main/java/cn/lunadeer/essentialsd/commands/EnderChest.java index cf28487..68dda45 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/EnderChest.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/EnderChest.java @@ -18,10 +18,6 @@ public class EnderChest implements CommandExecutor { Notification.error(sender, "只有玩家才能使用这个命令"); return false; } - if (!EssentialsD.config.getCommandsEnderchest()) { - Notification.error(sender, "这个命令已被管理员禁用"); - return false; - } // 打开玩家的末影箱 Player player = (Player) sender; Inventory chest = player.getEnderChest(); diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Fly.java b/src/main/java/cn/lunadeer/essentialsd/commands/Fly.java index a228394..2afd965 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Fly.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Fly.java @@ -1,6 +1,5 @@ package cn.lunadeer.essentialsd.commands; -import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Scheduler; import org.bukkit.command.Command; @@ -9,17 +8,17 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import static cn.lunadeer.essentialsd.commands.Apis.notOpOrConsole; -import static cn.lunadeer.essentialsd.commands.Apis.opCommandGetPlayer; +import static cn.lunadeer.essentialsd.commands.Apis.getPlayerFromArg; public class Fly implements CommandExecutor { @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { - if (notOpOrConsole(sender)) { + if (!(sender instanceof Player) && args.length < 1) { + Notification.error(sender, "以控制台身份执行时,必须指定玩家:/fly "); return false; } Scheduler.runTask(() -> { - Player target = opCommandGetPlayer(sender, args); + Player target = getPlayerFromArg(sender, args, 0); if (target == null) { return; } diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/God.java b/src/main/java/cn/lunadeer/essentialsd/commands/God.java index 9b8729d..b3ee481 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/God.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/God.java @@ -1,6 +1,5 @@ package cn.lunadeer.essentialsd.commands; -import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Scheduler; import org.bukkit.command.Command; @@ -9,17 +8,17 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import static cn.lunadeer.essentialsd.commands.Apis.notOpOrConsole; -import static cn.lunadeer.essentialsd.commands.Apis.opCommandGetPlayer; +import static cn.lunadeer.essentialsd.commands.Apis.getPlayerFromArg; public class God implements CommandExecutor { @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { - if (notOpOrConsole(sender)) { + if (!(sender instanceof Player) && args.length < 1) { + Notification.error(sender, "以控制台身份执行时,必须指定玩家:/god "); return false; } Scheduler.runTask(() -> { - Player target = opCommandGetPlayer(sender, args); + Player target = getPlayerFromArg(sender, args, 0); if (target == null) { return; } diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Hat.java b/src/main/java/cn/lunadeer/essentialsd/commands/Hat.java index 9abc632..d20347d 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Hat.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Hat.java @@ -1,6 +1,5 @@ package cn.lunadeer.essentialsd.commands; -import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.minecraftpluginutils.Notification; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -17,10 +16,6 @@ public class Hat implements CommandExecutor { Notification.warn(sender, "只有玩家可以使用此命令"); return true; } - if (!EssentialsD.config.getCommandsHat()) { - Notification.error(sender, "这个命令已被管理员禁用"); - return false; - } Player player = (Player) sender; PlayerInventory inventory = player.getInventory(); ItemStack right_hand_item = inventory.getItemInMainHand(); diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Inspect.java b/src/main/java/cn/lunadeer/essentialsd/commands/Inspect.java index f3d94db..0ea853f 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Inspect.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Inspect.java @@ -1,9 +1,7 @@ package cn.lunadeer.essentialsd.commands; -import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Scheduler; -import cn.lunadeer.minecraftpluginutils.XLogger; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -11,8 +9,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.jetbrains.annotations.NotNull; -import static cn.lunadeer.essentialsd.commands.Apis.notOpOrConsole; -import static cn.lunadeer.essentialsd.commands.Apis.opCommandGetPlayer; +import static cn.lunadeer.essentialsd.commands.Apis.getPlayerFromArg; public class Inspect implements CommandExecutor { /** @@ -34,11 +31,8 @@ public class Inspect implements CommandExecutor { return false; } Player op = (Player) sender; - if (notOpOrConsole(sender)) { - return false; - } Scheduler.runTask(() -> { - Player target = opCommandGetPlayer(sender, args); + Player target = getPlayerFromArg(op, args, 0); if (target == null) { return; } diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/More.java b/src/main/java/cn/lunadeer/essentialsd/commands/More.java index 70be3aa..c7f4e82 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/More.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/More.java @@ -1,6 +1,5 @@ package cn.lunadeer.essentialsd.commands; -import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.minecraftpluginutils.Notification; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -11,16 +10,15 @@ import org.jetbrains.annotations.NotNull; import java.util.Map; -import static cn.lunadeer.essentialsd.commands.Apis.getIfOP; - public class More implements CommandExecutor { @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { - Player player = getIfOP(sender); - if (player == null) { - return false; + if (!(sender instanceof Player)) { + Notification.warn(sender, "只有玩家可以使用此命令"); + return true; } - int amount = 64; + Player player = (Player) sender; + int amount = 63; if (args.length > 0) { try { amount = Integer.parseInt(args[0]); diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Night.java b/src/main/java/cn/lunadeer/essentialsd/commands/Night.java index 942598b..fad435b 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Night.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Night.java @@ -1,15 +1,11 @@ package cn.lunadeer.essentialsd.commands; -import cn.lunadeer.essentialsd.EssentialsD; -import cn.lunadeer.minecraftpluginutils.Notification; -import cn.lunadeer.minecraftpluginutils.Scheduler; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import static cn.lunadeer.essentialsd.commands.Apis.notOpOrConsole; +import static cn.lunadeer.essentialsd.commands.Apis.setOverWorldTime; public class Night implements CommandExecutor { /** @@ -26,19 +22,7 @@ public class Night implements CommandExecutor { */ @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { - if (notOpOrConsole(sender)) { - return false; - } - // set time to 13000 - Scheduler.runTask(() -> { - if (sender instanceof Player) { - ((Player) sender).getWorld().setTime(13000); - Notification.info(sender, "设置 %s 时间为夜晚", ((Player) sender).getWorld().getName()); - } else { - EssentialsD.instance.getServer().getWorlds().forEach(world -> world.setTime(13000)); - Notification.info(sender, "设置时间为夜晚"); - } - }); + setOverWorldTime(sender, 13000); return true; } } diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Noon.java b/src/main/java/cn/lunadeer/essentialsd/commands/Noon.java index 7b999c7..7656e55 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Noon.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Noon.java @@ -1,15 +1,12 @@ package cn.lunadeer.essentialsd.commands; -import cn.lunadeer.essentialsd.EssentialsD; -import cn.lunadeer.minecraftpluginutils.Notification; -import cn.lunadeer.minecraftpluginutils.Scheduler; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import static cn.lunadeer.essentialsd.commands.Apis.notOpOrConsole; +import static cn.lunadeer.essentialsd.commands.Apis.setOverWorldTime; + public class Noon implements CommandExecutor { /** @@ -26,19 +23,7 @@ public class Noon implements CommandExecutor { */ @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { - if (notOpOrConsole(sender)) { - return false; - } - // set time to 6000 - Scheduler.runTask(() -> { - if (sender instanceof Player) { - ((Player) sender).getWorld().setTime(6000); - Notification.info(sender, "设置 %s 时间为正午", ((Player) sender).getWorld().getName()); - } else { - EssentialsD.instance.getServer().getWorlds().forEach(world -> world.setTime(6000)); - Notification.info(sender, "设置时间为正午"); - } - }); + setOverWorldTime(sender, 6000); return true; } } diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Rain.java b/src/main/java/cn/lunadeer/essentialsd/commands/Rain.java index e841a00..da2850a 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Rain.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Rain.java @@ -3,26 +3,24 @@ package cn.lunadeer.essentialsd.commands; import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Scheduler; +import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import static cn.lunadeer.essentialsd.commands.Apis.getIfOP; public class Rain implements CommandExecutor { @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { - Player player = getIfOP(sender); - if (player == null) { - return true; - } - // 设置天气为雨天 Scheduler.runTask(() -> { - player.getWorld().setStorm(true); - player.getWorld().setThundering(false); - Notification.info(player, "设置 %s 天气为雨天", player.getWorld().getName()); + EssentialsD.instance.getServer().getWorlds().forEach(world -> { + if (world.getEnvironment() == World.Environment.NORMAL) { + world.setStorm(true); + world.setThundering(false); + Notification.info(sender, "设置 %s 天气为雨天", world.getName()); + } + }); }); return true; } diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Rtp.java b/src/main/java/cn/lunadeer/essentialsd/commands/Rtp.java index 16ab403..56fe368 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Rtp.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Rtp.java @@ -18,10 +18,6 @@ public class Rtp implements TabExecutor { Notification.warn(sender, "只有玩家可以使用此命令"); return true; } - if (!EssentialsD.config.getCommandsRtp()) { - Notification.error(sender, "这个命令已被管理员禁用"); - return false; - } Player player = (Player) sender; EssentialsD.tpManager.rtp(player); return true; diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Save.java b/src/main/java/cn/lunadeer/essentialsd/commands/Save.java index 65833f6..4874a74 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Save.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Save.java @@ -8,7 +8,6 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.jetbrains.annotations.NotNull; -import static cn.lunadeer.essentialsd.commands.Apis.notOpOrConsole; public class Save implements CommandExecutor { /** @@ -25,9 +24,6 @@ public class Save implements CommandExecutor { */ @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { - if (notOpOrConsole(sender)) { - return false; - } // 保存服务器存档 Notification.info(sender, "正在保存服务器存档..."); EssentialsD.instance.getServer().savePlayers(); diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/ShowItem.java b/src/main/java/cn/lunadeer/essentialsd/commands/ShowItem.java index 1ba24e9..2028a70 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/ShowItem.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/ShowItem.java @@ -27,10 +27,6 @@ public class ShowItem implements CommandExecutor { Notification.warn(sender, "只有玩家可以使用此命令"); return true; } - if (!EssentialsD.config.getCommandsShowItem()) { - Notification.error(sender, "这个命令已被管理员禁用"); - return false; - } Player player = (Player) sender; if (args.length == 1) { openView(player, args[0]); diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Skull.java b/src/main/java/cn/lunadeer/essentialsd/commands/Skull.java index e7835a9..955c5fd 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Skull.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Skull.java @@ -1,6 +1,5 @@ package cn.lunadeer.essentialsd.commands; -import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.minecraftpluginutils.Notification; import org.bukkit.Material; import org.bukkit.command.Command; @@ -23,10 +22,6 @@ public class Skull implements CommandExecutor { Notification.warn(sender, "只有玩家可以使用此命令"); return true; } - if (!EssentialsD.config.getCommandsSkull()) { - Notification.error(sender, "这个命令已被管理员禁用"); - return false; - } Player player = (Player) sender; PlayerInventory backpack = player.getInventory(); Map creeper_skulls = backpack.all(Material.CREEPER_HEAD); diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Storm.java b/src/main/java/cn/lunadeer/essentialsd/commands/Storm.java index 9102609..76109c7 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Storm.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Storm.java @@ -3,26 +3,24 @@ package cn.lunadeer.essentialsd.commands; import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Scheduler; +import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import static cn.lunadeer.essentialsd.commands.Apis.getIfOP; public class Storm implements CommandExecutor { @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { - Player player = getIfOP(sender); - if (player == null) { - return true; - } - // 设置天气为雷雨 Scheduler.runTask(() -> { - player.getWorld().setStorm(true); - player.getWorld().setThundering(true); - Notification.info(player, "设置 %s 天气为雷雨", player.getWorld().getName()); + EssentialsD.instance.getServer().getWorlds().forEach(world -> { + if (world.getEnvironment() == World.Environment.NORMAL) { + world.setStorm(true); + world.setThundering(true); + Notification.info(sender, "设置 %s 天气为雷雨", world.getName()); + } + }); }); return true; } diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Suicide.java b/src/main/java/cn/lunadeer/essentialsd/commands/Suicide.java index 8b53e57..6895f96 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Suicide.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Suicide.java @@ -1,6 +1,5 @@ package cn.lunadeer.essentialsd.commands; -import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.minecraftpluginutils.Notification; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -16,10 +15,6 @@ public class Suicide implements CommandExecutor { Notification.warn(sender, "只有玩家可以使用此命令"); return true; } - if (!EssentialsD.config.getCommandsSuicide()) { - Notification.error(sender, "这个命令已被管理员禁用"); - return false; - } Player player = (Player) sender; player.setHealth(0.0); player.setKiller(player); diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Sun.java b/src/main/java/cn/lunadeer/essentialsd/commands/Sun.java index b842f30..14a29a4 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Sun.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Sun.java @@ -3,26 +3,24 @@ package cn.lunadeer.essentialsd.commands; import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Scheduler; +import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import static cn.lunadeer.essentialsd.commands.Apis.getIfOP; public class Sun implements CommandExecutor { @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { - Player player = getIfOP(sender); - if (player == null) { - return true; - } Scheduler.runTask(() -> { - // 设置天气为晴朗 - player.getWorld().setStorm(false); - player.getWorld().setThundering(false); - Notification.info(player, "设置 %s 天气为晴朗", player.getWorld().getName()); + EssentialsD.instance.getServer().getWorlds().forEach(world -> { + if (world.getEnvironment() == World.Environment.NORMAL) { + world.setStorm(false); + world.setThundering(false); + Notification.info(sender, "设置 %s 天气为晴朗", world.getName()); + } + }); }); return true; } diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/Tpa.java b/src/main/java/cn/lunadeer/essentialsd/commands/Tpa.java index 0a524d5..e5e4aa4 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/Tpa.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/Tpa.java @@ -20,10 +20,6 @@ public class Tpa implements TabExecutor { Notification.warn(sender, "只有玩家可以使用此命令"); return true; } - if (!EssentialsD.config.getCommandsTpa()) { - Notification.error(sender, "这个命令已被管理员禁用"); - return false; - } Player player = (Player) sender; if (args.length == 1) { Player target = EssentialsD.instance.getServer().getPlayer(args[0]); @@ -31,7 +27,7 @@ public class Tpa implements TabExecutor { Notification.warn(player, "玩家 %s 不在线", args[0]); return true; } - EssentialsD.tpManager.request(player, target); + EssentialsD.tpManager.tpaRequest(player, target); return true; } else if (args.length == 2) { if (args[0].equals("accept")) { diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/TpaHere.java b/src/main/java/cn/lunadeer/essentialsd/commands/TpaHere.java new file mode 100644 index 0000000..6be52a9 --- /dev/null +++ b/src/main/java/cn/lunadeer/essentialsd/commands/TpaHere.java @@ -0,0 +1,49 @@ +package cn.lunadeer.essentialsd.commands; + +import cn.lunadeer.essentialsd.EssentialsD; +import cn.lunadeer.minecraftpluginutils.Notification; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.command.TabExecutor; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collection; +import java.util.List; + +public class TpaHere implements TabExecutor { + @Override + public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { + if (!(sender instanceof Player)) { + Notification.warn(sender, "只有玩家可以使用此命令"); + return true; + } + Player player = (Player) sender; + if (args.length == 1) { + Player target = EssentialsD.instance.getServer().getPlayer(args[0]); + if (target == null) { + Notification.warn(player, "玩家 %s 不在线", args[0]); + return true; + } + EssentialsD.tpManager.tpahereRequest(player, target); + return true; + } else { + Notification.error(player, "参数错误"); + return false; + } + } + + @Override + public @Nullable List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { + if (args.length == 1) { + Collection players = EssentialsD.instance.getServer().getOnlinePlayers(); + List result = new java.util.ArrayList<>(); + for (Player player : players) { + result.add(player.getName()); + } + return result; + } + return null; + } +} diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/home/DelHome.java b/src/main/java/cn/lunadeer/essentialsd/commands/home/DelHome.java index 7ac7aff..24866de 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/home/DelHome.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/home/DelHome.java @@ -1,6 +1,5 @@ package cn.lunadeer.essentialsd.commands.home; -import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.essentialsd.dtos.HomeInfo; import cn.lunadeer.essentialsd.tuis.HomeList; import cn.lunadeer.minecraftpluginutils.Notification; @@ -21,10 +20,6 @@ public class DelHome implements TabExecutor { Notification.warn(sender, "只有玩家可以使用此命令"); return true; } - if (!EssentialsD.config.getCommandsHome()) { - Notification.error(sender, "这个命令已被管理员禁用"); - return false; - } Player player = (Player) sender; String homeName; if (args.length == 0) { diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/home/Home.java b/src/main/java/cn/lunadeer/essentialsd/commands/home/Home.java index 8f51611..d6f97a5 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/home/Home.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/home/Home.java @@ -20,10 +20,6 @@ public class Home implements TabExecutor { Notification.warn(sender, "只有玩家可以使用此命令"); return true; } - if (!EssentialsD.config.getCommandsHome()) { - Notification.error(sender, "这个命令已被管理员禁用"); - return false; - } Player player = (Player) sender; List homes = HomeInfo.getHomesOf(player.getUniqueId()); String homeName; diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/home/Homes.java b/src/main/java/cn/lunadeer/essentialsd/commands/home/Homes.java index 8c8b2bb..34610aa 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/home/Homes.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/home/Homes.java @@ -1,8 +1,6 @@ package cn.lunadeer.essentialsd.commands.home; -import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.essentialsd.tuis.HomeList; -import cn.lunadeer.minecraftpluginutils.Notification; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabExecutor; @@ -14,10 +12,6 @@ import java.util.List; public class Homes implements TabExecutor { @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { - if (!EssentialsD.config.getCommandsHome()) { - Notification.error(sender, "这个命令已被管理员禁用"); - return false; - } HomeList.show(sender, args); return true; } diff --git a/src/main/java/cn/lunadeer/essentialsd/commands/home/SetHome.java b/src/main/java/cn/lunadeer/essentialsd/commands/home/SetHome.java index 1f79d5c..35429ca 100644 --- a/src/main/java/cn/lunadeer/essentialsd/commands/home/SetHome.java +++ b/src/main/java/cn/lunadeer/essentialsd/commands/home/SetHome.java @@ -20,10 +20,6 @@ public class SetHome implements TabExecutor { Notification.warn(sender, "只有玩家可以使用此命令"); return true; } - if (!EssentialsD.config.getCommandsHome()) { - Notification.error(sender, "这个命令已被管理员禁用"); - return false; - } Player player = (Player) sender; List homes = HomeInfo.getHomesOf(((Player) sender).getUniqueId()); if (homes.size() > EssentialsD.config.getHomeLimitAmount()) { diff --git a/src/main/java/cn/lunadeer/essentialsd/managers/ConfigManager.java b/src/main/java/cn/lunadeer/essentialsd/managers/ConfigManager.java index 33d5b87..bbad922 100644 --- a/src/main/java/cn/lunadeer/essentialsd/managers/ConfigManager.java +++ b/src/main/java/cn/lunadeer/essentialsd/managers/ConfigManager.java @@ -30,15 +30,6 @@ public class ConfigManager { _no_exp_cool_down = _file.getBoolean("NoExpCoolDown", false); _force_load_chunks = _file.getStringList("ForceLoadChunks"); _chunk_operate_delay = _file.getInt("ChunkOperateDelay", 10); - _commands_tpa = _file.getBoolean("Commands.Tpa", true); - _commands_rtp = _file.getBoolean("Commands.Rtp", true); - _commands_back = _file.getBoolean("Commands.Back", true); - _commands_enderchest = _file.getBoolean("Commands.EnderChest", true); - _commands_suicide = _file.getBoolean("Commands.Suicide", true); - _commands_hat = _file.getBoolean("Commands.Hat", true); - _commands_showitem = _file.getBoolean("Commands.ShowItem", true); - _commands_skull = _file.getBoolean("Commands.Skull", true); - _commands_home = _file.getBoolean("Commands.Home", true); _tp_delay = _file.getInt("Teleport.Delay", 0); _tp_cool_down = _file.getInt("Teleport.CoolDown", 0); _tp_tpa_expire = _file.getInt("Teleport.TpaExpire", 30); @@ -157,43 +148,6 @@ public class ConfigManager { return _tp_world_blacklist; } - public Boolean getCommandsTpa() { - return _commands_tpa; - } - - public Boolean getCommandsRtp() { - return _commands_rtp; - } - - public Boolean getCommandsBack() { - return _commands_back; - } - - public Boolean getCommandsEnderchest() { - return _commands_enderchest; - } - - public Boolean getCommandsSuicide() { - return _commands_suicide; - } - - public Boolean getCommandsHat() { - return _commands_hat; - } - - public Boolean getCommandsShowItem() { - return _commands_showitem; - } - - public Boolean getCommandsSkull() { - return _commands_skull; - } - - public Boolean getCommandsHome() { - return _commands_home; - } - - public Boolean getChairEnable() { return _chair_enable; } @@ -340,16 +294,6 @@ public class ConfigManager { private Boolean _chair_sign_check; private Float _chair_sit_height; private Boolean _check_update; - // commands - private Boolean _commands_tpa; - private Boolean _commands_rtp; - private Boolean _commands_back; - private Boolean _commands_enderchest; - private Boolean _commands_suicide; - private Boolean _commands_hat; - private Boolean _commands_showitem; - private Boolean _commands_skull; - private Boolean _commands_home; // recipes private Boolean _recipes_crowbar; private Boolean _recipes_invisible_item_frame; diff --git a/src/main/java/cn/lunadeer/essentialsd/managers/TeleportManager.java b/src/main/java/cn/lunadeer/essentialsd/managers/TeleportManager.java index 833c9e7..0fdb583 100644 --- a/src/main/java/cn/lunadeer/essentialsd/managers/TeleportManager.java +++ b/src/main/java/cn/lunadeer/essentialsd/managers/TeleportManager.java @@ -7,7 +7,9 @@ import cn.lunadeer.minecraftpluginutils.XLogger; import cn.lunadeer.minecraftpluginutils.stui.components.Button; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.format.Style; import net.kyori.adventure.text.format.TextColor; +import net.kyori.adventure.text.format.TextDecoration; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; @@ -32,25 +34,30 @@ public class TeleportManager { public Player initiator; public Player target; public UUID taskId; + public Boolean tpahere = false; } - public void request(Player initiator, Player target) { + private boolean tpReqCheckFail(Player initiator, Player target) { if (initiator == target) { - Notification.error(initiator, "不能传送到自己的位置"); - return; + Notification.error(initiator, "不能传送到同一个位置"); + return true; } if (!target.isOnline()) { Notification.error(initiator, "玩家 " + target.getName() + " 不在线"); - return; + return true; } if (EssentialsD.config.getTpWorldBlackList().contains(target.getWorld().getName())) { Notification.error(initiator, "目的地所在世界 " + initiator.getWorld().getName() + " 不允许传送"); - return; + return true; } - if (CoolingDown(initiator)) return; + return CoolingDown(initiator); + } + + public void tpaRequest(Player initiator, Player target) { + if (tpReqCheckFail(initiator, target)) return; TpTask task = new TpTask(); task.initiator = initiator; @@ -62,11 +69,36 @@ public class TeleportManager { TextComponent acceptBtn = Button.createGreen("接受").setExecuteCommand("/tpa accept " + task.taskId).build(); TextComponent denyBtn = Button.createRed("拒绝").setExecuteCommand("/tpa deny " + task.taskId).build(); - Notification.info(target, Component.text("━━━━━━━━━━━━━━━━━━━━━━━━━━━━", main_color)); + Notification.info(target, Component.text(" ", Style.style(main_color, TextDecoration.STRIKETHROUGH))); Notification.info(target, Component.text("| 玩家 " + initiator.getName() + " 请求传送到你的位置", main_color)); Notification.info(target, Component.text("| 此请求将在 " + EssentialsD.config.getTpTpaExpire() + " 秒后失效", main_color)); Notification.info(target, Component.text("| ", main_color).append(acceptBtn).append(Component.text(" ", main_color)).append(denyBtn)); - Notification.info(target, Component.text("━━━━━━━━━━━━━━━━━━━━━━━━━━━━", main_color)); + Notification.info(target, Component.text(" ", Style.style(main_color, TextDecoration.STRIKETHROUGH))); + + Scheduler.runTaskLater(() -> { + _tasks.remove(task.taskId); + }, 20L * EssentialsD.config.getTpTpaExpire()); + } + + public void tpahereRequest(Player initiator, Player target) { + if (tpReqCheckFail(initiator, target)) return; + + TpTask task = new TpTask(); + task.initiator = initiator; + task.target = target; + task.taskId = UUID.randomUUID(); + task.tpahere = true; + _tasks.put(task.taskId, task); + + Notification.info(initiator, "已向 " + target.getName() + " 发送传送请求"); + + TextComponent acceptBtn = Button.createGreen("接受").setExecuteCommand("/tpahere accept " + task.taskId).build(); + TextComponent denyBtn = Button.createRed("拒绝").setExecuteCommand("/tpahere deny " + task.taskId).build(); + Notification.info(target, Component.text(" ", Style.style(main_color, TextDecoration.STRIKETHROUGH))); + Notification.info(target, Component.text("| 玩家 " + initiator.getName() + " 请求传送你到他的位置", main_color)); + Notification.info(target, Component.text("| 此请求将在 " + EssentialsD.config.getTpTpaExpire() + " 秒后失效", main_color)); + Notification.info(target, Component.text("| ", main_color).append(acceptBtn).append(Component.text(" ", main_color)).append(denyBtn)); + Notification.info(target, Component.text(" ", Style.style(main_color, TextDecoration.STRIKETHROUGH))); Scheduler.runTaskLater(() -> { _tasks.remove(task.taskId); @@ -110,15 +142,28 @@ public class TeleportManager { Notification.info(task.target, "已接受 " + task.initiator.getName() + " 的传送请求"); Notification.info(task.initiator, "玩家 " + task.target.getName() + " 已接受你的传送请求"); - try { - doTeleportDelayed(task.initiator, task.target.getLocation(), EssentialsD.config.getTpDelay(), () -> { - Notification.info(task.initiator, "正在传送到 " + task.initiator.getName() + " 的位置"); - }, () -> { - Notification.info(task.initiator, "已传送到 " + task.initiator.getName() + " 的位置"); - Notification.info(task.target, "玩家 " + task.initiator.getName() + " 已传送到你的位置"); - }); - } catch (RuntimeException e) { - Notification.error(player, e.getMessage()); + if (!task.tpahere) { + try { + doTeleportDelayed(task.initiator, task.target.getLocation(), EssentialsD.config.getTpDelay(), () -> { + Notification.info(task.initiator, "正在传送到 " + task.initiator.getName() + " 的位置"); + }, () -> { + Notification.info(task.initiator, "已传送到 " + task.initiator.getName() + " 的位置"); + Notification.info(task.target, "玩家 " + task.initiator.getName() + " 已传送到你的位置"); + }); + } catch (RuntimeException e) { + Notification.error(player, e.getMessage()); + } + } else { + try { + doTeleportDelayed(task.target, task.initiator.getLocation(), EssentialsD.config.getTpDelay(), () -> { + Notification.info(task.target, "正在传送到 " + task.initiator.getName() + " 的位置"); + }, () -> { + Notification.info(task.target, "已传送到 " + task.initiator.getName() + " 的位置"); + Notification.info(task.initiator, "玩家 " + task.target.getName() + " 已传送到你的位置"); + }); + } catch (RuntimeException e) { + Notification.error(player, e.getMessage()); + } } } @@ -174,22 +219,38 @@ public class TeleportManager { doTeleportDelayed(player, location, delay.longValue(), before, after); } - public void doTeleportDelayed(Player player, Location location, Long delay, Runnable before, Runnable after) { - if (EssentialsD.config.getTpWorldBlackList().contains(location.getWorld().getName())) { - Notification.error(player, "目的地所在世界 %s 不允许传送", location.getWorld().getName()); + public void doTeleportDelayed(Player player, Location to, Long delay, Runnable before, Runnable after) { + if (EssentialsD.config.getTpWorldBlackList().contains(to.getWorld().getName())) { + Notification.error(player, "目的地所在世界 %s 不允许传送", to.getWorld().getName()); return; } if (CoolingDown(player)) return; if (delay > 0) { - Notification.info(player, "将在 %d 秒后执行传送", EssentialsD.config.getTpDelay()); + Notification.info(player, "将在 %d 秒后执行传送", delay); + Scheduler.runTaskAsync(() -> { + long i = delay; + while (i > 0) { + if (!player.isOnline()) { + return; + } + Notification.actionBar(player, "传送倒计时 %d 秒", i); + i--; + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + XLogger.warn(e.getMessage()); + return; + } + } + }); Scheduler.runTaskLater(() -> { before.run(); - doTeleportSafely(player, location); + doTeleportSafely(player, to); after.run(); }, 20L * delay); } else { before.run(); - doTeleportSafely(player, location); + doTeleportSafely(player, to); after.run(); } } @@ -200,7 +261,7 @@ public class TeleportManager { if (next_time != null) { if (now.isBefore(next_time)) { long secs_until_next = now.until(next_time, java.time.temporal.ChronoUnit.SECONDS); - Notification.warn(player, "请等待 %d 秒后再次传送", secs_until_next); + Notification.warn(player, "请等待 %d 秒后再次执行传送请求", secs_until_next); return true; } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 35e8beb..685dfb8 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -35,18 +35,6 @@ Recipes: LightBlock: true # 光源方块 StackedEnchantBook: true # 附魔书堆叠 -# 扩展指令 -Commands: - EnderChest: true # 快速末影箱 - Suicide: true # 自杀 - Hat: true # 把东西戴在头上 - ShowItem: true # 展示手中物品 - Skull: true # 获取头颅 - Tpa: true # 传送到其他玩家 - Rtp: true # 随机传送到附近 - Back: true # 回到上一个传送位置 - Home: true # home相关指令 包含 sethome delhome home homes - # 传送 Teleport: Delay: 0 # 传送延迟 秒 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index f17142d..7071e90 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -4,75 +4,166 @@ main: cn.lunadeer.essentialsd.EssentialsD api-version: '1.20' description: Deer's Essentials website: https://lunadeer.cn -load: POSTWORLD +load: STARTUP folia-supported: true +softdepend: + - LuckPerms +permissions: + essd.*: + default: op + description: 允许使用 EssentialsD 的所有功能 + essd.suicide: + default: true + essd.hat: + default: true + essd.showitem: + default: true + essd.skull: + default: true + essd.god: + default: op + essd.fly: + default: op + essd.time: + default: op + essd.save: + default: op + essd.more: + default: op + essd.weather: + default: op + essd.enderchest: + default: true + essd.tp.*: + default: true + children: + essd.tp.tpa: true + essd.tp.tpahere: true + essd.tp.rtp: true + essd.tp.back: true + essd.inspect: + default: op + essd.home: + default: true + commands: suicide: description: 自杀 usage: /suicide + permission: essd.suicide + permission-message: 你不被允许自杀,快说“谢谢管理员”。 hat: description: 将主手持的物品放在头部 usage: /hat + permission: essd.hat + permission-message: 管理员不允许你随便在头上放东西(没权限)。 showItem: description: 展示主手持的物品 usage: /showitem + permission: essd.showitem + permission-message: 不要什么都想拿出来啊喂!(没权限) skull: description: 使用任意头颅交换获得一个自己的头颅 usage: /skull + permission: essd.skull + permission-message: 禁止献祭(没权限)。 god: description: 无敌模式 usage: /god [player] + permission: essd.god + permission-message: 禁止成仙(没权限)。 fly: description: 飞行模式 usage: /fly [player] + permission: essd.fly + permission-message: 禁止起飞(没权限)。 day: description: 设置时间为白天 usage: /day + permission: essd.time + permission-message: 起床失败(没权限)。 noon: description: 设置时间为中午 usage: /noon + permission: essd.time + permission-message: 午休失败(没权限)。 night: description: 设置时间为晚上 usage: /night + permission: essd.time + permission-message: 禁止熬夜(没权限)。 save: description: 保存 usage: /save + permission: essd.save + permission-message: 保存失败(没权限)。 more: description: 获取更多手持物品 usage: /more [amount] + permission: essd.more + permission-message: more不出来了(没权限)。 sun: description: 设置天气为晴天 usage: /sun + permission: essd.weather + permission-message: 禁止晒太阳(没权限)。 rain: description: 设置天气为雨天 usage: /rain + permission: essd.weather + permission-message: 求雨失败(没权限)。 storm: description: 设置天气为雷雨 usage: /storm + permission: essd.weather + permission-message: (没权限)。 enderchest: description: 通过指令打开末影箱 usage: /enderchest + permission: essd.enderchest + permission-message: 你没有权限快速打开末影箱。 tpa: description: 发起传送请求 usage: /tpa + permission: essd.tp.tpa + permission-message: 你没有权限发起传送请求。 + tpahere: + description: 发起传送到自己的请求 + usage: /tpahere + permission: essd.tp.tpahere + permission-message: 你没有权限发起传送请求。 rtp: description: 随机传送到附近 usage: /rtp + permission: essd.tp.rtp + permission-message: 你没有权限随机传送。 back: description: 回到上一个传送点 usage: /back + permission: essd.tp.back + permission-message: 你没有权限回到上一个传送点。 inspect: description: 检查玩家背包 usage: /inspect + permission: essd.inspect + permission-message: 禁止偷窥(没权限)。 home: description: 回家 usage: /home [名称] + permission: essd.home + permission-message: 你没有权限使用home。 homes: description: 查看家列表 usage: /homes + permission: essd.home + permission-message: 你没有权限使用home。 sethome: description: 设置家 usage: /sethome [名称] + permission: essd.home + permission-message: 你没有权限使用home。 delhome: description: 删除家 - usage: /delhome <名称> \ No newline at end of file + usage: /delhome <名称> + permission: essd.home + permission-message: 你没有权限使用home。 \ No newline at end of file