Add permissions debug option to debug command

This commit is contained in:
GeorgH93 2023-07-18 21:03:55 +02:00
parent f0d22d071a
commit 0058dd8c63
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
1 changed files with 26 additions and 4 deletions

View File

@ -74,11 +74,9 @@ public class DebugCommand extends MinepacksCommand
}
@SneakyThrows
@Override
public void execute(@NotNull CommandSender commandSender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
private void debugSystem(final @NotNull CommandSender commandSender)
{
if(writer != null) return;
Player sender = (Player) commandSender;
final Player sender = (Player) commandSender;
messageStart.send(sender);
File debugFile = new File(plugin.getDataFolder(), "debug.txt");
@ -134,6 +132,30 @@ public class DebugCommand extends MinepacksCommand
}, 30*20L);
}
@SneakyThrows
@Override
public void execute(@NotNull CommandSender commandSender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
{
if(writer != null) return;
if (args.length == 2 && args[0].equals("permissions"))
{
Player player = Bukkit.getServer().getPlayer(args[1]);
if (player == null)
{
commandSender.sendMessage("Player " + args[1] + " is offline.");
return;
}
commandSender.sendMessage("### Permissions for " + player.getName() + " ###");
for(String perm : Permissions.getPermissions())
{
commandSender.sendMessage(perm + ": " + player.hasPermission(perm));
}
commandSender.sendMessage("###############################");
}
else
debugSystem(commandSender);
}
@Override
public List<String> tabComplete(@NotNull CommandSender commandSender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
{