新增权限节点支持,移除配置文件的commands
All checks were successful
Java CI-CD with Maven / build (push) Successful in 7m14s

This commit is contained in:
zhangyuheng 2024-07-16 14:16:29 +08:00
parent cb9716e7b0
commit 440c4c9fa6
31 changed files with 295 additions and 315 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId> <groupId>cn.lunadeer</groupId>
<artifactId>EssentialsD</artifactId> <artifactId>EssentialsD</artifactId>
<version>1.22.1</version> <version>2.0.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>EssentialsD</name> <name>EssentialsD</name>

View File

@ -65,6 +65,7 @@ public final class EssentialsD extends JavaPlugin {
Objects.requireNonNull(Bukkit.getPluginCommand("showitem")).setExecutor(new ShowItem()); Objects.requireNonNull(Bukkit.getPluginCommand("showitem")).setExecutor(new ShowItem());
Objects.requireNonNull(Bukkit.getPluginCommand("skull")).setExecutor(new Skull()); Objects.requireNonNull(Bukkit.getPluginCommand("skull")).setExecutor(new Skull());
Objects.requireNonNull(Bukkit.getPluginCommand("tpa")).setExecutor(new Tpa()); 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("rtp")).setExecutor(new Rtp());
Objects.requireNonNull(Bukkit.getPluginCommand("back")).setExecutor(new Back()); Objects.requireNonNull(Bukkit.getPluginCommand("back")).setExecutor(new Back());
Objects.requireNonNull(Bukkit.getPluginCommand("home")).setExecutor(new Home()); Objects.requireNonNull(Bukkit.getPluginCommand("home")).setExecutor(new Home());

View File

@ -2,7 +2,8 @@ package cn.lunadeer.essentialsd.commands;
import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.minecraftpluginutils.Notification; 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.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -10,26 +11,6 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class Apis { 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 命令参数 * @param args 命令参数
* @return 如果指定了玩家则返回玩家对象否则返回命令发送者 * @return 如果指定了玩家则返回玩家对象否则返回命令发送者
*/ */
public static Player opCommandGetPlayer(CommandSender sender, String[] args) { public static Player getPlayerFromArg(CommandSender sender, String[] args, int pos) {
Player target; Player target = EssentialsD.instance.getServer().getPlayer(args[pos]);
if (args.length == 1) { if (target == null) {
target = EssentialsD.instance.getServer().getPlayer(args[0]); Notification.warn(sender, "玩家 %s 不在线", args[0]);
if (target == null) { return null;
Notification.warn(sender, "玩家 %s 不在线", args[0]);
return null;
}
} else {
if (!(sender instanceof Player)) {
Notification.warn(sender, "请指定要操作的玩家");
return null;
}
target = (Player) sender;
} }
return target; 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<String> playerNames() { public static List<String> playerNames() {
return EssentialsD.instance.getServer().getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList()); 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);
}
});
});
}
} }

View File

@ -18,10 +18,6 @@ public class Back implements TabExecutor {
Notification.warn(sender, "只有玩家可以使用此命令"); Notification.warn(sender, "只有玩家可以使用此命令");
return true; return true;
} }
if (!EssentialsD.config.getCommandsBack()) {
Notification.error(sender, "这个命令已被管理员禁用");
return false;
}
Player player = (Player) sender; Player player = (Player) sender;
EssentialsD.tpManager.back(player); EssentialsD.tpManager.back(player);
return true; return true;

View File

@ -1,15 +1,12 @@
package cn.lunadeer.essentialsd.commands; 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.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; 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 { public class Day implements CommandExecutor {
/** /**
@ -26,19 +23,8 @@ public class Day implements CommandExecutor {
*/ */
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (notOpOrConsole(sender)) {
return false;
}
// set time to 1000 // set time to 1000
Scheduler.runTask(() -> { setOverWorldTime(sender, 1000);
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, "设置时间为白天");
}
});
return true; return true;
} }
} }

View File

@ -18,10 +18,6 @@ public class EnderChest implements CommandExecutor {
Notification.error(sender, "只有玩家才能使用这个命令"); Notification.error(sender, "只有玩家才能使用这个命令");
return false; return false;
} }
if (!EssentialsD.config.getCommandsEnderchest()) {
Notification.error(sender, "这个命令已被管理员禁用");
return false;
}
// 打开玩家的末影箱 // 打开玩家的末影箱
Player player = (Player) sender; Player player = (Player) sender;
Inventory chest = player.getEnderChest(); Inventory chest = player.getEnderChest();

View File

@ -1,6 +1,5 @@
package cn.lunadeer.essentialsd.commands; package cn.lunadeer.essentialsd.commands;
import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Notification;
import cn.lunadeer.minecraftpluginutils.Scheduler; import cn.lunadeer.minecraftpluginutils.Scheduler;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -9,17 +8,17 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import static cn.lunadeer.essentialsd.commands.Apis.notOpOrConsole; import static cn.lunadeer.essentialsd.commands.Apis.getPlayerFromArg;
import static cn.lunadeer.essentialsd.commands.Apis.opCommandGetPlayer;
public class Fly implements CommandExecutor { public class Fly implements CommandExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { 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 <player>");
return false; return false;
} }
Scheduler.runTask(() -> { Scheduler.runTask(() -> {
Player target = opCommandGetPlayer(sender, args); Player target = getPlayerFromArg(sender, args, 0);
if (target == null) { if (target == null) {
return; return;
} }

View File

@ -1,6 +1,5 @@
package cn.lunadeer.essentialsd.commands; package cn.lunadeer.essentialsd.commands;
import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Notification;
import cn.lunadeer.minecraftpluginutils.Scheduler; import cn.lunadeer.minecraftpluginutils.Scheduler;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -9,17 +8,17 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import static cn.lunadeer.essentialsd.commands.Apis.notOpOrConsole; import static cn.lunadeer.essentialsd.commands.Apis.getPlayerFromArg;
import static cn.lunadeer.essentialsd.commands.Apis.opCommandGetPlayer;
public class God implements CommandExecutor { public class God implements CommandExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { 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 <player>");
return false; return false;
} }
Scheduler.runTask(() -> { Scheduler.runTask(() -> {
Player target = opCommandGetPlayer(sender, args); Player target = getPlayerFromArg(sender, args, 0);
if (target == null) { if (target == null) {
return; return;
} }

View File

@ -1,6 +1,5 @@
package cn.lunadeer.essentialsd.commands; package cn.lunadeer.essentialsd.commands;
import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Notification;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -17,10 +16,6 @@ public class Hat implements CommandExecutor {
Notification.warn(sender, "只有玩家可以使用此命令"); Notification.warn(sender, "只有玩家可以使用此命令");
return true; return true;
} }
if (!EssentialsD.config.getCommandsHat()) {
Notification.error(sender, "这个命令已被管理员禁用");
return false;
}
Player player = (Player) sender; Player player = (Player) sender;
PlayerInventory inventory = player.getInventory(); PlayerInventory inventory = player.getInventory();
ItemStack right_hand_item = inventory.getItemInMainHand(); ItemStack right_hand_item = inventory.getItemInMainHand();

View File

@ -1,9 +1,7 @@
package cn.lunadeer.essentialsd.commands; package cn.lunadeer.essentialsd.commands;
import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Notification;
import cn.lunadeer.minecraftpluginutils.Scheduler; import cn.lunadeer.minecraftpluginutils.Scheduler;
import cn.lunadeer.minecraftpluginutils.XLogger;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -11,8 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import static cn.lunadeer.essentialsd.commands.Apis.notOpOrConsole; import static cn.lunadeer.essentialsd.commands.Apis.getPlayerFromArg;
import static cn.lunadeer.essentialsd.commands.Apis.opCommandGetPlayer;
public class Inspect implements CommandExecutor { public class Inspect implements CommandExecutor {
/** /**
@ -34,11 +31,8 @@ public class Inspect implements CommandExecutor {
return false; return false;
} }
Player op = (Player) sender; Player op = (Player) sender;
if (notOpOrConsole(sender)) {
return false;
}
Scheduler.runTask(() -> { Scheduler.runTask(() -> {
Player target = opCommandGetPlayer(sender, args); Player target = getPlayerFromArg(op, args, 0);
if (target == null) { if (target == null) {
return; return;
} }

View File

@ -1,6 +1,5 @@
package cn.lunadeer.essentialsd.commands; package cn.lunadeer.essentialsd.commands;
import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Notification;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -11,16 +10,15 @@ import org.jetbrains.annotations.NotNull;
import java.util.Map; import java.util.Map;
import static cn.lunadeer.essentialsd.commands.Apis.getIfOP;
public class More implements CommandExecutor { public class More implements CommandExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
Player player = getIfOP(sender); if (!(sender instanceof Player)) {
if (player == null) { Notification.warn(sender, "只有玩家可以使用此命令");
return false; return true;
} }
int amount = 64; Player player = (Player) sender;
int amount = 63;
if (args.length > 0) { if (args.length > 0) {
try { try {
amount = Integer.parseInt(args[0]); amount = Integer.parseInt(args[0]);

View File

@ -1,15 +1,11 @@
package cn.lunadeer.essentialsd.commands; 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.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; 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 { public class Night implements CommandExecutor {
/** /**
@ -26,19 +22,7 @@ public class Night implements CommandExecutor {
*/ */
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (notOpOrConsole(sender)) { setOverWorldTime(sender, 13000);
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, "设置时间为夜晚");
}
});
return true; return true;
} }
} }

View File

@ -1,15 +1,12 @@
package cn.lunadeer.essentialsd.commands; 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.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; 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 { public class Noon implements CommandExecutor {
/** /**
@ -26,19 +23,7 @@ public class Noon implements CommandExecutor {
*/ */
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (notOpOrConsole(sender)) { setOverWorldTime(sender, 6000);
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, "设置时间为正午");
}
});
return true; return true;
} }
} }

View File

@ -3,26 +3,24 @@ package cn.lunadeer.essentialsd.commands;
import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Notification;
import cn.lunadeer.minecraftpluginutils.Scheduler; import cn.lunadeer.minecraftpluginutils.Scheduler;
import org.bukkit.World;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import static cn.lunadeer.essentialsd.commands.Apis.getIfOP;
public class Rain implements CommandExecutor { public class Rain implements CommandExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { 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(() -> { Scheduler.runTask(() -> {
player.getWorld().setStorm(true); EssentialsD.instance.getServer().getWorlds().forEach(world -> {
player.getWorld().setThundering(false); if (world.getEnvironment() == World.Environment.NORMAL) {
Notification.info(player, "设置 %s 天气为雨天", player.getWorld().getName()); world.setStorm(true);
world.setThundering(false);
Notification.info(sender, "设置 %s 天气为雨天", world.getName());
}
});
}); });
return true; return true;
} }

View File

@ -18,10 +18,6 @@ public class Rtp implements TabExecutor {
Notification.warn(sender, "只有玩家可以使用此命令"); Notification.warn(sender, "只有玩家可以使用此命令");
return true; return true;
} }
if (!EssentialsD.config.getCommandsRtp()) {
Notification.error(sender, "这个命令已被管理员禁用");
return false;
}
Player player = (Player) sender; Player player = (Player) sender;
EssentialsD.tpManager.rtp(player); EssentialsD.tpManager.rtp(player);
return true; return true;

View File

@ -8,7 +8,6 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import static cn.lunadeer.essentialsd.commands.Apis.notOpOrConsole;
public class Save implements CommandExecutor { public class Save implements CommandExecutor {
/** /**
@ -25,9 +24,6 @@ public class Save implements CommandExecutor {
*/ */
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (notOpOrConsole(sender)) {
return false;
}
// 保存服务器存档 // 保存服务器存档
Notification.info(sender, "正在保存服务器存档..."); Notification.info(sender, "正在保存服务器存档...");
EssentialsD.instance.getServer().savePlayers(); EssentialsD.instance.getServer().savePlayers();

View File

@ -27,10 +27,6 @@ public class ShowItem implements CommandExecutor {
Notification.warn(sender, "只有玩家可以使用此命令"); Notification.warn(sender, "只有玩家可以使用此命令");
return true; return true;
} }
if (!EssentialsD.config.getCommandsShowItem()) {
Notification.error(sender, "这个命令已被管理员禁用");
return false;
}
Player player = (Player) sender; Player player = (Player) sender;
if (args.length == 1) { if (args.length == 1) {
openView(player, args[0]); openView(player, args[0]);

View File

@ -1,6 +1,5 @@
package cn.lunadeer.essentialsd.commands; package cn.lunadeer.essentialsd.commands;
import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Notification;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -23,10 +22,6 @@ public class Skull implements CommandExecutor {
Notification.warn(sender, "只有玩家可以使用此命令"); Notification.warn(sender, "只有玩家可以使用此命令");
return true; return true;
} }
if (!EssentialsD.config.getCommandsSkull()) {
Notification.error(sender, "这个命令已被管理员禁用");
return false;
}
Player player = (Player) sender; Player player = (Player) sender;
PlayerInventory backpack = player.getInventory(); PlayerInventory backpack = player.getInventory();
Map<Integer, ? extends ItemStack> creeper_skulls = backpack.all(Material.CREEPER_HEAD); Map<Integer, ? extends ItemStack> creeper_skulls = backpack.all(Material.CREEPER_HEAD);

View File

@ -3,26 +3,24 @@ package cn.lunadeer.essentialsd.commands;
import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Notification;
import cn.lunadeer.minecraftpluginutils.Scheduler; import cn.lunadeer.minecraftpluginutils.Scheduler;
import org.bukkit.World;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import static cn.lunadeer.essentialsd.commands.Apis.getIfOP;
public class Storm implements CommandExecutor { public class Storm implements CommandExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { 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(() -> { Scheduler.runTask(() -> {
player.getWorld().setStorm(true); EssentialsD.instance.getServer().getWorlds().forEach(world -> {
player.getWorld().setThundering(true); if (world.getEnvironment() == World.Environment.NORMAL) {
Notification.info(player, "设置 %s 天气为雷雨", player.getWorld().getName()); world.setStorm(true);
world.setThundering(true);
Notification.info(sender, "设置 %s 天气为雷雨", world.getName());
}
});
}); });
return true; return true;
} }

View File

@ -1,6 +1,5 @@
package cn.lunadeer.essentialsd.commands; package cn.lunadeer.essentialsd.commands;
import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Notification;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -16,10 +15,6 @@ public class Suicide implements CommandExecutor {
Notification.warn(sender, "只有玩家可以使用此命令"); Notification.warn(sender, "只有玩家可以使用此命令");
return true; return true;
} }
if (!EssentialsD.config.getCommandsSuicide()) {
Notification.error(sender, "这个命令已被管理员禁用");
return false;
}
Player player = (Player) sender; Player player = (Player) sender;
player.setHealth(0.0); player.setHealth(0.0);
player.setKiller(player); player.setKiller(player);

View File

@ -3,26 +3,24 @@ package cn.lunadeer.essentialsd.commands;
import cn.lunadeer.essentialsd.EssentialsD; import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Notification;
import cn.lunadeer.minecraftpluginutils.Scheduler; import cn.lunadeer.minecraftpluginutils.Scheduler;
import org.bukkit.World;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import static cn.lunadeer.essentialsd.commands.Apis.getIfOP;
public class Sun implements CommandExecutor { public class Sun implements CommandExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { 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(() -> { Scheduler.runTask(() -> {
// 设置天气为晴朗 EssentialsD.instance.getServer().getWorlds().forEach(world -> {
player.getWorld().setStorm(false); if (world.getEnvironment() == World.Environment.NORMAL) {
player.getWorld().setThundering(false); world.setStorm(false);
Notification.info(player, "设置 %s 天气为晴朗", player.getWorld().getName()); world.setThundering(false);
Notification.info(sender, "设置 %s 天气为晴朗", world.getName());
}
});
}); });
return true; return true;
} }

View File

@ -20,10 +20,6 @@ public class Tpa implements TabExecutor {
Notification.warn(sender, "只有玩家可以使用此命令"); Notification.warn(sender, "只有玩家可以使用此命令");
return true; return true;
} }
if (!EssentialsD.config.getCommandsTpa()) {
Notification.error(sender, "这个命令已被管理员禁用");
return false;
}
Player player = (Player) sender; Player player = (Player) sender;
if (args.length == 1) { if (args.length == 1) {
Player target = EssentialsD.instance.getServer().getPlayer(args[0]); Player target = EssentialsD.instance.getServer().getPlayer(args[0]);
@ -31,7 +27,7 @@ public class Tpa implements TabExecutor {
Notification.warn(player, "玩家 %s 不在线", args[0]); Notification.warn(player, "玩家 %s 不在线", args[0]);
return true; return true;
} }
EssentialsD.tpManager.request(player, target); EssentialsD.tpManager.tpaRequest(player, target);
return true; return true;
} else if (args.length == 2) { } else if (args.length == 2) {
if (args[0].equals("accept")) { if (args[0].equals("accept")) {

View File

@ -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<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (args.length == 1) {
Collection<? extends Player> players = EssentialsD.instance.getServer().getOnlinePlayers();
List<String> result = new java.util.ArrayList<>();
for (Player player : players) {
result.add(player.getName());
}
return result;
}
return null;
}
}

View File

@ -1,6 +1,5 @@
package cn.lunadeer.essentialsd.commands.home; package cn.lunadeer.essentialsd.commands.home;
import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.essentialsd.dtos.HomeInfo; import cn.lunadeer.essentialsd.dtos.HomeInfo;
import cn.lunadeer.essentialsd.tuis.HomeList; import cn.lunadeer.essentialsd.tuis.HomeList;
import cn.lunadeer.minecraftpluginutils.Notification; import cn.lunadeer.minecraftpluginutils.Notification;
@ -21,10 +20,6 @@ public class DelHome implements TabExecutor {
Notification.warn(sender, "只有玩家可以使用此命令"); Notification.warn(sender, "只有玩家可以使用此命令");
return true; return true;
} }
if (!EssentialsD.config.getCommandsHome()) {
Notification.error(sender, "这个命令已被管理员禁用");
return false;
}
Player player = (Player) sender; Player player = (Player) sender;
String homeName; String homeName;
if (args.length == 0) { if (args.length == 0) {

View File

@ -20,10 +20,6 @@ public class Home implements TabExecutor {
Notification.warn(sender, "只有玩家可以使用此命令"); Notification.warn(sender, "只有玩家可以使用此命令");
return true; return true;
} }
if (!EssentialsD.config.getCommandsHome()) {
Notification.error(sender, "这个命令已被管理员禁用");
return false;
}
Player player = (Player) sender; Player player = (Player) sender;
List<HomeInfo> homes = HomeInfo.getHomesOf(player.getUniqueId()); List<HomeInfo> homes = HomeInfo.getHomesOf(player.getUniqueId());
String homeName; String homeName;

View File

@ -1,8 +1,6 @@
package cn.lunadeer.essentialsd.commands.home; package cn.lunadeer.essentialsd.commands.home;
import cn.lunadeer.essentialsd.EssentialsD;
import cn.lunadeer.essentialsd.tuis.HomeList; import cn.lunadeer.essentialsd.tuis.HomeList;
import cn.lunadeer.minecraftpluginutils.Notification;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;
@ -14,10 +12,6 @@ import java.util.List;
public class Homes implements TabExecutor { public class Homes implements TabExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { 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); HomeList.show(sender, args);
return true; return true;
} }

View File

@ -20,10 +20,6 @@ public class SetHome implements TabExecutor {
Notification.warn(sender, "只有玩家可以使用此命令"); Notification.warn(sender, "只有玩家可以使用此命令");
return true; return true;
} }
if (!EssentialsD.config.getCommandsHome()) {
Notification.error(sender, "这个命令已被管理员禁用");
return false;
}
Player player = (Player) sender; Player player = (Player) sender;
List<HomeInfo> homes = HomeInfo.getHomesOf(((Player) sender).getUniqueId()); List<HomeInfo> homes = HomeInfo.getHomesOf(((Player) sender).getUniqueId());
if (homes.size() > EssentialsD.config.getHomeLimitAmount()) { if (homes.size() > EssentialsD.config.getHomeLimitAmount()) {

View File

@ -30,15 +30,6 @@ public class ConfigManager {
_no_exp_cool_down = _file.getBoolean("NoExpCoolDown", false); _no_exp_cool_down = _file.getBoolean("NoExpCoolDown", false);
_force_load_chunks = _file.getStringList("ForceLoadChunks"); _force_load_chunks = _file.getStringList("ForceLoadChunks");
_chunk_operate_delay = _file.getInt("ChunkOperateDelay", 10); _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_delay = _file.getInt("Teleport.Delay", 0);
_tp_cool_down = _file.getInt("Teleport.CoolDown", 0); _tp_cool_down = _file.getInt("Teleport.CoolDown", 0);
_tp_tpa_expire = _file.getInt("Teleport.TpaExpire", 30); _tp_tpa_expire = _file.getInt("Teleport.TpaExpire", 30);
@ -157,43 +148,6 @@ public class ConfigManager {
return _tp_world_blacklist; 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() { public Boolean getChairEnable() {
return _chair_enable; return _chair_enable;
} }
@ -340,16 +294,6 @@ public class ConfigManager {
private Boolean _chair_sign_check; private Boolean _chair_sign_check;
private Float _chair_sit_height; private Float _chair_sit_height;
private Boolean _check_update; 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 // recipes
private Boolean _recipes_crowbar; private Boolean _recipes_crowbar;
private Boolean _recipes_invisible_item_frame; private Boolean _recipes_invisible_item_frame;

View File

@ -7,7 +7,9 @@ import cn.lunadeer.minecraftpluginutils.XLogger;
import cn.lunadeer.minecraftpluginutils.stui.components.Button; import cn.lunadeer.minecraftpluginutils.stui.components.Button;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent; 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.TextColor;
import net.kyori.adventure.text.format.TextDecoration;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
@ -32,25 +34,30 @@ public class TeleportManager {
public Player initiator; public Player initiator;
public Player target; public Player target;
public UUID taskId; public UUID taskId;
public Boolean tpahere = false;
} }
public void request(Player initiator, Player target) { private boolean tpReqCheckFail(Player initiator, Player target) {
if (initiator == target) { if (initiator == target) {
Notification.error(initiator, "不能传送到自己的位置"); Notification.error(initiator, "不能传送到同一个位置");
return; return true;
} }
if (!target.isOnline()) { if (!target.isOnline()) {
Notification.error(initiator, "玩家 " + target.getName() + " 不在线"); Notification.error(initiator, "玩家 " + target.getName() + " 不在线");
return; return true;
} }
if (EssentialsD.config.getTpWorldBlackList().contains(target.getWorld().getName())) { if (EssentialsD.config.getTpWorldBlackList().contains(target.getWorld().getName())) {
Notification.error(initiator, "目的地所在世界 " + initiator.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(); TpTask task = new TpTask();
task.initiator = initiator; task.initiator = initiator;
@ -62,11 +69,36 @@ public class TeleportManager {
TextComponent acceptBtn = Button.createGreen("接受").setExecuteCommand("/tpa accept " + task.taskId).build(); TextComponent acceptBtn = Button.createGreen("接受").setExecuteCommand("/tpa accept " + task.taskId).build();
TextComponent denyBtn = Button.createRed("拒绝").setExecuteCommand("/tpa deny " + 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("| 玩家 " + initiator.getName() + " 请求传送到你的位置", main_color));
Notification.info(target, Component.text("| 此请求将在 " + EssentialsD.config.getTpTpaExpire() + " 秒后失效", 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).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(() -> { Scheduler.runTaskLater(() -> {
_tasks.remove(task.taskId); _tasks.remove(task.taskId);
@ -110,15 +142,28 @@ public class TeleportManager {
Notification.info(task.target, "已接受 " + task.initiator.getName() + " 的传送请求"); Notification.info(task.target, "已接受 " + task.initiator.getName() + " 的传送请求");
Notification.info(task.initiator, "玩家 " + task.target.getName() + " 已接受你的传送请求"); Notification.info(task.initiator, "玩家 " + task.target.getName() + " 已接受你的传送请求");
try { if (!task.tpahere) {
doTeleportDelayed(task.initiator, task.target.getLocation(), EssentialsD.config.getTpDelay(), () -> { try {
Notification.info(task.initiator, "正在传送到 " + task.initiator.getName() + " 的位置"); 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() + " 已传送到你的位置"); Notification.info(task.initiator, "已传送到 " + task.initiator.getName() + " 的位置");
}); Notification.info(task.target, "玩家 " + task.initiator.getName() + " 已传送到你的位置");
} catch (RuntimeException e) { });
Notification.error(player, e.getMessage()); } 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); doTeleportDelayed(player, location, delay.longValue(), before, after);
} }
public void doTeleportDelayed(Player player, Location location, Long delay, Runnable before, Runnable after) { public void doTeleportDelayed(Player player, Location to, Long delay, Runnable before, Runnable after) {
if (EssentialsD.config.getTpWorldBlackList().contains(location.getWorld().getName())) { if (EssentialsD.config.getTpWorldBlackList().contains(to.getWorld().getName())) {
Notification.error(player, "目的地所在世界 %s 不允许传送", location.getWorld().getName()); Notification.error(player, "目的地所在世界 %s 不允许传送", to.getWorld().getName());
return; return;
} }
if (CoolingDown(player)) return; if (CoolingDown(player)) return;
if (delay > 0) { 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(() -> { Scheduler.runTaskLater(() -> {
before.run(); before.run();
doTeleportSafely(player, location); doTeleportSafely(player, to);
after.run(); after.run();
}, 20L * delay); }, 20L * delay);
} else { } else {
before.run(); before.run();
doTeleportSafely(player, location); doTeleportSafely(player, to);
after.run(); after.run();
} }
} }
@ -200,7 +261,7 @@ public class TeleportManager {
if (next_time != null) { if (next_time != null) {
if (now.isBefore(next_time)) { if (now.isBefore(next_time)) {
long secs_until_next = now.until(next_time, java.time.temporal.ChronoUnit.SECONDS); 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; return true;
} }
} }

View File

@ -35,18 +35,6 @@ Recipes:
LightBlock: true # 光源方块 LightBlock: true # 光源方块
StackedEnchantBook: 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: Teleport:
Delay: 0 # 传送延迟 秒 Delay: 0 # 传送延迟 秒

View File

@ -4,75 +4,166 @@ main: cn.lunadeer.essentialsd.EssentialsD
api-version: '1.20' api-version: '1.20'
description: Deer's Essentials description: Deer's Essentials
website: https://lunadeer.cn website: https://lunadeer.cn
load: POSTWORLD load: STARTUP
folia-supported: true 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: commands:
suicide: suicide:
description: 自杀 description: 自杀
usage: /suicide usage: /suicide
permission: essd.suicide
permission-message: 你不被允许自杀,快说“谢谢管理员”。
hat: hat:
description: 将主手持的物品放在头部 description: 将主手持的物品放在头部
usage: /hat usage: /hat
permission: essd.hat
permission-message: 管理员不允许你随便在头上放东西(没权限)。
showItem: showItem:
description: 展示主手持的物品 description: 展示主手持的物品
usage: /showitem usage: /showitem
permission: essd.showitem
permission-message: 不要什么都想拿出来啊喂!(没权限)
skull: skull:
description: 使用任意头颅交换获得一个自己的头颅 description: 使用任意头颅交换获得一个自己的头颅
usage: /skull usage: /skull
permission: essd.skull
permission-message: 禁止献祭(没权限)。
god: god:
description: 无敌模式 description: 无敌模式
usage: /god [player] usage: /god [player]
permission: essd.god
permission-message: 禁止成仙(没权限)。
fly: fly:
description: 飞行模式 description: 飞行模式
usage: /fly [player] usage: /fly [player]
permission: essd.fly
permission-message: 禁止起飞(没权限)。
day: day:
description: 设置时间为白天 description: 设置时间为白天
usage: /day usage: /day
permission: essd.time
permission-message: 起床失败(没权限)。
noon: noon:
description: 设置时间为中午 description: 设置时间为中午
usage: /noon usage: /noon
permission: essd.time
permission-message: 午休失败(没权限)。
night: night:
description: 设置时间为晚上 description: 设置时间为晚上
usage: /night usage: /night
permission: essd.time
permission-message: 禁止熬夜(没权限)。
save: save:
description: 保存 description: 保存
usage: /save usage: /save
permission: essd.save
permission-message: 保存失败(没权限)。
more: more:
description: 获取更多手持物品 description: 获取更多手持物品
usage: /more [amount] usage: /more [amount]
permission: essd.more
permission-message: more不出来了没权限
sun: sun:
description: 设置天气为晴天 description: 设置天气为晴天
usage: /sun usage: /sun
permission: essd.weather
permission-message: 禁止晒太阳(没权限)。
rain: rain:
description: 设置天气为雨天 description: 设置天气为雨天
usage: /rain usage: /rain
permission: essd.weather
permission-message: 求雨失败(没权限)。
storm: storm:
description: 设置天气为雷雨 description: 设置天气为雷雨
usage: /storm usage: /storm
permission: essd.weather
permission-message: (没权限)。
enderchest: enderchest:
description: 通过指令打开末影箱 description: 通过指令打开末影箱
usage: /enderchest usage: /enderchest
permission: essd.enderchest
permission-message: 你没有权限快速打开末影箱。
tpa: tpa:
description: 发起传送请求 description: 发起传送请求
usage: /tpa <player> usage: /tpa <player>
permission: essd.tp.tpa
permission-message: 你没有权限发起传送请求。
tpahere:
description: 发起传送到自己的请求
usage: /tpahere <player>
permission: essd.tp.tpahere
permission-message: 你没有权限发起传送请求。
rtp: rtp:
description: 随机传送到附近 description: 随机传送到附近
usage: /rtp usage: /rtp
permission: essd.tp.rtp
permission-message: 你没有权限随机传送。
back: back:
description: 回到上一个传送点 description: 回到上一个传送点
usage: /back usage: /back
permission: essd.tp.back
permission-message: 你没有权限回到上一个传送点。
inspect: inspect:
description: 检查玩家背包 description: 检查玩家背包
usage: /inspect <player> usage: /inspect <player>
permission: essd.inspect
permission-message: 禁止偷窥(没权限)。
home: home:
description: 回家 description: 回家
usage: /home [名称] usage: /home [名称]
permission: essd.home
permission-message: 你没有权限使用home。
homes: homes:
description: 查看家列表 description: 查看家列表
usage: /homes usage: /homes
permission: essd.home
permission-message: 你没有权限使用home。
sethome: sethome:
description: 设置家 description: 设置家
usage: /sethome [名称] usage: /sethome [名称]
permission: essd.home
permission-message: 你没有权限使用home。
delhome: delhome:
description: 删除家 description: 删除家
usage: /delhome <名称> usage: /delhome <名称>
permission: essd.home
permission-message: 你没有权限使用home。