public PermissionAttachmentInfo(IPermissible permissible, string permission, PermissionAttachment attachment, bool value) { if (permissible == null) { throw new ArgumentException("Permissible may not be null"); } else if (permission == null) { throw new ArgumentException("Permissions may not be null"); } this.permissible = permissible; this.permission = permission; this.attachment = attachment; this.value = value; }
public PermissionAttachment AddAttachment(IPlugin plugin) { if (plugin == null) { throw new ArgumentException("Plugin cannot be null"); } else if (!plugin.isEnabled()) { throw new ArgumentException("Plugin " + plugin.PluginDescription.FullName + " is disabled"); } PermissionAttachment result = new PermissionAttachment(plugin, parent); attachments.Add(result); RecalculatePermissions(); return(result); }
public PermissionAttachment AddAttachment(IPlugin plugin, string name, bool value) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Permission name cannot be null"); } else 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); result.SetPermission(name, value); RecalculatePermissions(); return(result); }
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); } }
public RemoveAttachmentRunnable(PermissionAttachment attachment) { this.attachment = attachment; }
public void RemoveAttachment(PermissionAttachment attachment) { return(new HashSet <PermissionAttachmentInfo>(permissions.Values)); }