Skip to content

Commit

Permalink
添加top指令
Browse files Browse the repository at this point in the history
  • Loading branch information
windy664 authored Aug 9, 2024
1 parent 4b07f09 commit 2b46faa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/org/windy/teleportoffset/TeleportOffset.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ private void log(String message) {

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = (Player) sender;
if (command.getName().equalsIgnoreCase("teleportoffset")) {
if (args.length > 0 && args[0].equalsIgnoreCase("reload")) {
if (!sender.hasPermission("teleportoffset.reload")) {
Expand All @@ -80,8 +81,12 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
debugMode = !debugMode; // 切换debug模式
sender.sendMessage("§aDebug模式已临时" + (debugMode ? "开启" : "关闭"));
return true;
} else if (args.length > 0 && args[0].equalsIgnoreCase("top")) {
Location location = player.getLocation();
findHighestNonAirBlockLocation(location);
player.teleport(location);
}else{
sender.sendMessage("§c用法: /teleportoffset reload");
sender.sendMessage(Texts.help);
return true;
}
}
Expand Down

0 comments on commit 2b46faa

Please sign in to comment.