/** * Adds this permission to the specified parent permission. * <p> * If the parent permission does not exist, it will be created and * registered. * * @param name Name of the parent permission * @param value The value to set this permission to * @return Parent permission it created or loaded */ public Permission addParent(String name, boolean value) { PluginManager pm = Bukkit.getServer().getPluginManager(); String lname = name.toLowerCase(); Permission perm = pm.getPermission(lname); if (perm == null) { perm = new Permission(lname); pm.addPermission(perm); } addParent(perm, value); return perm; }
/** * Adds this permission to the specified parent permission. * <p> * If the parent permission does not exist, it will be created and * registered. * * @param name Name of the parent permission * @param value The value to set this permission to * @return Parent permission it created or loaded */ public Permission addParent(String name, boolean value) { PluginManager pm = Bukkit.getServer().getPluginManager(); String lname = name.toLowerCase(); Permission perm = pm.getPermission(lname); if (perm == null) { perm = new Permission(lname); pm.addPermission(perm); } addParent(perm, value); return perm; }
childPermission.addParent(permission, childValue);
if (!cmdHadPerm) { cmdPerm.addParent(rootPerm, true);
childPermission.addParent(permission, true);
/** * Initializes permissions. */ private void initPerms() { this.permission = new Permission("multiverse.access." + this.getName(), "Allows access to " + this.getName(), PermissionDefault.OP); // This guy is special. He shouldn't be added to any parent perms. this.ignoreperm = new Permission("mv.bypass.gamemode." + this.getName(), "Allows players with this permission to ignore gamemode changes.", PermissionDefault.FALSE); this.exempt = new Permission("multiverse.exempt." + this.getName(), "A player who has this does not pay to enter this world, or use any MV portals in it " + this.getName(), PermissionDefault.OP); this.limitbypassperm = new Permission("mv.bypass.playerlimit." + this.getName(), "A player who can enter this world regardless of wether its full", PermissionDefault.OP); try { this.plugin.getServer().getPluginManager().addPermission(this.permission); this.plugin.getServer().getPluginManager().addPermission(this.exempt); this.plugin.getServer().getPluginManager().addPermission(this.ignoreperm); this.plugin.getServer().getPluginManager().addPermission(this.limitbypassperm); // Add the permission and exempt to parents. this.addToUpperLists(this.permission); // Add ignore to it's parent: this.ignoreperm.addParent("mv.bypass.gamemode.*", true); // Add limit bypass to it's parent this.limitbypassperm.addParent("mv.bypass.playerlimit.*", true); } catch (IllegalArgumentException e) { this.plugin.log(Level.FINER, "Permissions nodes were already added for " + this.name); } }