public bool HasPermissions(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Permission name cannot be null"); } name = name.ToLower(); if (IsPermissionSet(name)) { return(permissions[name].Value); } else { Permission perm = Bukkit.getServer().getPluginManager().getPermission(name); if (perm != null) { return(perm.Default.getValue(IsOP())); } else { return(Permission.DEFAULT_PERMISSION.getValue(IsOp())); } } }
public PermissionAttachment AddAttachment(IPlugin plugin, int ticks) { if (plugin == null) { throw new ArgumentException("Plugin cannot be null"); } else if (!plugin.Enabled) { throw new ArgumentException("Plugin " + plugin.PluginDescription.FullName + " is disabled"); } PermissionAttachment result = AddAttachment(plugin); if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new RemoveAttachmentRunnable(result), ticks) == -1) { Bukkit.getServer().getLogger().log(Level.WARNING, "Could not add PermissionAttachment to " + parent + " for plugin " + plugin.PluginDescription.FullName + ": Scheduler returned -1"); result.Remove(); return(null); } else { return(result); } }