/** * Tests the given {@link CommandSender} to see if they can perform this * command. * <p> * If they do not have permission, they will be informed that they cannot * do this. * * @param target User to test * @return true if they can use it, otherwise false */ public boolean testPermission(CommandSender target) { if (testPermissionSilent(target)) { return true; } if (permissionMessage == null) { target.sendMessage(ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error."); } else if (permissionMessage.length() != 0) { for (String line : permissionMessage.replace("<permission>", permission).split("\n")) { target.sendMessage(line); } } return false; }
public boolean canSee(CommandSender sender) { if (!command.isRegistered() && !(command instanceof VanillaCommand)) { // Unregistered commands should not show up in the help (ignore VanillaCommands) return false; } if (sender instanceof ConsoleCommandSender) { return true; } if (amendedPermission != null) { return sender.hasPermission(amendedPermission); } else { return command.testPermissionSilent(sender); } } }
Command command = commandEntry.getValue(); if (!command.testPermissionSilent(sender)) { continue; if (!target.testPermissionSilent(sender)) { return null;
return super.testPermissionSilent(sender);
@Override public boolean testPermissionSilent(MCCommandSender target) { return cmd.testPermissionSilent(((BukkitMCCommandSender) target)._CommandSender()); }
@SuppressWarnings("unchecked") @Override public boolean testPermissionSilent(CommandSender sender) { if (permissions == null || permissions.length == 0) { return true; } if (registeredWith instanceof CommandsManager<?>) { try { for (String permission : permissions) { if (((CommandsManager<CommandSender>) registeredWith).hasPermission(sender, permission)) { return true; } } return false; } catch (Throwable ignore) { } } return super.testPermissionSilent(sender); } }
/** * Tests the given {@link CommandSender} to see if they can perform this * command. * <p> * If they do not have permission, they will be informed that they cannot * do this. * * @param target User to test * @return true if they can use it, otherwise false */ public boolean testPermission(CommandSender target) { if (testPermissionSilent(target)) { return true; } if (permissionMessage == null) { target.sendMessage(ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error."); } else if (permissionMessage.length() != 0) { for (String line : permissionMessage.replace("<permission>", permission).split("\n")) { target.sendMessage(line); } } return false; }
public boolean canSee(CommandSender sender) { if (!command.isRegistered() && !(command instanceof VanillaCommand)) { // Unregistered commands should not show up in the help (ignore VanillaCommands) return false; } if (sender instanceof ConsoleCommandSender) { return true; } if (amendedPermission != null) { return sender.hasPermission(amendedPermission); } else { return command.testPermissionSilent(sender); } } }
Command command = commandEntry.getValue(); if (!command.testPermissionSilent(sender)) { continue; if (!target.testPermissionSilent(sender)) { return null;