*/
public void checkAllowedItem(CommandSender sender, int id, int damage)
throws CommandException {
if (Material.getMaterial(id) == null || id == 0) {
throw new CommandException("Non-existent item specified.");
}
// Check if the user has an override
if (CommandBook.inst().hasPermission(sender, "commandbook.override.any-item")) {
return;
}
boolean hasPermissions = CommandBook.inst().hasPermission(sender, "commandbook.items." + id)
|| CommandBook.inst().hasPermission(sender, "commandbook.items." + id + "." + damage);
// Also check the permissions system
if (hasPermissions) {
return;
}
if (config.useItemPermissionsOnly) {
throw new CommandException("That item is not allowed.");
}
if (config.allowedItems.size() > 0) {
if (!config.allowedItems.contains(id)) {
throw new CommandException("That item is not allowed.");
}
}
if (config.disallowedItems.contains((id))) {
throw new CommandException("That item is disallowed.");
}
}