public Permission(String name, String description, PermissionDefault defaultValue, Map<String, Boolean> children) { this.name = name; this.description = (description == null) ? "" : description; if (defaultValue != null) { this.defaultValue = defaultValue; } if (children != null) { this.children.putAll(children); } recalculatePermissibles(); }
/** * Sets the default value of this permission. * <p> * This will not be saved to disk, and is a temporary operation until the * server reloads permissions. Changing this default will cause all {@link * Permissible}s that contain this permission to recalculate their * permissions * * @param value The new default to set */ public void setDefault(PermissionDefault value) { if (defaultValue == null) { throw new IllegalArgumentException("Default value cannot be null"); } defaultValue = value; recalculatePermissibles(); }
/** * Adds this permission to the specified parent permission. * * @param perm Parent permission to register with * @param value The value to set this permission to */ public void addParent(Permission perm, boolean value) { perm.getChildren().put(getName(), value); perm.recalculatePermissibles(); }
public static Permission registerPermissions(Permission parent) { Permission broadcasts = DefaultPermissions.registerPermission(ROOT, "Allows the user to receive all broadcast messages", parent); DefaultPermissions.registerPermission(PREFIX + "admin", "Allows the user to receive administrative broadcasts", PermissionDefault.OP, broadcasts); DefaultPermissions.registerPermission(PREFIX + "user", "Allows the user to receive user broadcasts", PermissionDefault.TRUE, broadcasts); broadcasts.recalculatePermissibles(); return broadcasts; } }
public static void registerCorePermissions() { Permission parent = registerPermission(ROOT, "Gives the user the ability to use all CraftBukkit utilities and commands"); CommandPermissions.registerPermissions(parent); BroadcastPermissions.registerPermissions(parent); parent.recalculatePermissibles(); } }
private static Permission registerTime(Permission parent) { Permission time = DefaultPermissions.registerPermission(PREFIX + "time", "Allows the user to alter the time", PermissionDefault.OP, parent); DefaultPermissions.registerPermission(PREFIX + "time.add", "Allows the user to fast-forward time", time); DefaultPermissions.registerPermission(PREFIX + "time.set", "Allows the user to change the time", time); time.recalculatePermissibles(); return time; }
private static Permission registerUnban(Permission parent) { Permission unban = DefaultPermissions.registerPermission(PREFIX + "unban", "Allows the user to unban people", PermissionDefault.OP, parent); DefaultPermissions.registerPermission(PREFIX + "unban.player", "Allows the user to unban players", unban); DefaultPermissions.registerPermission(PREFIX + "unban.ip", "Allows the user to unban IP addresses", unban); unban.recalculatePermissibles(); return unban; }
private static Permission registerBan(Permission parent) { Permission ban = DefaultPermissions.registerPermission(PREFIX + "ban", "Allows the user to ban people", PermissionDefault.OP, parent); DefaultPermissions.registerPermission(PREFIX + "ban.player", "Allows the user to ban players", ban); DefaultPermissions.registerPermission(PREFIX + "ban.ip", "Allows the user to ban IP addresses", ban); ban.recalculatePermissibles(); return ban; }
private static Permission registerOp(Permission parent) { Permission op = DefaultPermissions.registerPermission(PREFIX + "op", "Allows the user to change operators", PermissionDefault.OP, parent); DefaultPermissions.registerPermission(PREFIX + "op.give", "Allows the user to give a player operator status", op); DefaultPermissions.registerPermission(PREFIX + "op.take", "Allows the user to take a players operator status", op); op.recalculatePermissibles(); return op; }
private static Permission registerSave(Permission parent) { Permission save = DefaultPermissions.registerPermission(PREFIX + "save", "Allows the user to save the worlds", PermissionDefault.OP, parent); DefaultPermissions.registerPermission(PREFIX + "save.enable", "Allows the user to enable automatic saving", save); DefaultPermissions.registerPermission(PREFIX + "save.disable", "Allows the user to disable automatic saving", save); DefaultPermissions.registerPermission(PREFIX + "save.perform", "Allows the user to perform a manual save", save); save.recalculatePermissibles(); return save; }
private static Permission registerWhitelist(Permission parent) { Permission whitelist = DefaultPermissions.registerPermission(PREFIX + "whitelist", "Allows the user to modify the server whitelist", PermissionDefault.OP, parent); DefaultPermissions.registerPermission(PREFIX + "whitelist.add", "Allows the user to add a player to the server whitelist", whitelist); DefaultPermissions.registerPermission(PREFIX + "whitelist.remove", "Allows the user to remove a player from the server whitelist", whitelist); DefaultPermissions.registerPermission(PREFIX + "whitelist.reload", "Allows the user to reload the server whitelist", whitelist); DefaultPermissions.registerPermission(PREFIX + "whitelist.enable", "Allows the user to enable the server whitelist", whitelist); DefaultPermissions.registerPermission(PREFIX + "whitelist.disable", "Allows the user to disable the server whitelist", whitelist); DefaultPermissions.registerPermission(PREFIX + "whitelist.list", "Allows the user to list all the users on the server whitelist", whitelist); whitelist.recalculatePermissibles(); return whitelist; }
.registerPermission("minecraft.command.tell", "Allows the user to send a " + "private message", PermissionDefault.TRUE, permissionRootCommand); permissionRootCommand.recalculatePermissibles(); permissionRoot.recalculatePermissibles(); helpMap.initializeCommands(); helpMap.amendTopics(config.getConfigFile(Key.HELP_FILE));
DefaultPermissions.registerPermission(PREFIX + "effect", "Allows the user to add/remove effects on players", PermissionDefault.OP, commands); commands.recalculatePermissibles();
public Permission(String name, String description, PermissionDefault defaultValue, Map<String, Boolean> children) { this.name = name; this.description = (description == null) ? "" : description; if (defaultValue != null) { this.defaultValue = defaultValue; } if (children != null) { this.children.putAll(children); } recalculatePermissibles(); }
private static Permission registerBan(Permission parent) { Permission ban = DefaultPermissions.registerPermission(PREFIX + "ban", "Allows the user to ban people", PermissionDefault.OP, parent); DefaultPermissions.registerPermission(PREFIX + "ban.player", "Allows the user to ban players", ban); DefaultPermissions.registerPermission(PREFIX + "ban.ip", "Allows the user to ban IP addresses", ban); ban.recalculatePermissibles(); return ban; }
private static Permission registerUnban(Permission parent) { Permission unban = DefaultPermissions.registerPermission(PREFIX + "unban", "Allows the user to unban people", PermissionDefault.OP, parent); DefaultPermissions.registerPermission(PREFIX + "unban.player", "Allows the user to unban players", unban); DefaultPermissions.registerPermission(PREFIX + "unban.ip", "Allows the user to unban IP addresses", unban); unban.recalculatePermissibles(); return unban; }
private void updateAndAdd(PluginManager pm, Permission permission) { Permission oldPerm = pm.getPermission(permission.getName()); if (oldPerm == null) { pm.addPermission(permission); } permission.recalculatePermissibles(); } }
private static Permission registerOp(Permission parent) { Permission op = DefaultPermissions.registerPermission(PREFIX + "op", "Allows the user to change operators", PermissionDefault.OP, parent); DefaultPermissions.registerPermission(PREFIX + "op.give", "Allows the user to give a player operator status", op); DefaultPermissions.registerPermission(PREFIX + "op.take", "Allows the user to take a players operator status", op); op.recalculatePermissibles(); return op; }
private static Permission registerSave(Permission parent) { Permission save = DefaultPermissions.registerPermission(PREFIX + "save", "Allows the user to save the worlds", PermissionDefault.OP, parent); DefaultPermissions.registerPermission(PREFIX + "save.enable", "Allows the user to enable automatic saving", save); DefaultPermissions.registerPermission(PREFIX + "save.disable", "Allows the user to disable automatic saving", save); DefaultPermissions.registerPermission(PREFIX + "save.perform", "Allows the user to perform a manual save", save); save.recalculatePermissibles(); return save; }
private static Permission registerWhitelist(Permission parent) { Permission whitelist = DefaultPermissions.registerPermission(PREFIX + "whitelist", "Allows the user to modify the server whitelist", PermissionDefault.OP, parent); DefaultPermissions.registerPermission(PREFIX + "whitelist.add", "Allows the user to add a player to the server whitelist", whitelist); DefaultPermissions.registerPermission(PREFIX + "whitelist.remove", "Allows the user to remove a player from the server whitelist", whitelist); DefaultPermissions.registerPermission(PREFIX + "whitelist.reload", "Allows the user to reload the server whitelist", whitelist); DefaultPermissions.registerPermission(PREFIX + "whitelist.enable", "Allows the user to enable the server whitelist", whitelist); DefaultPermissions.registerPermission(PREFIX + "whitelist.disable", "Allows the user to disable the server whitelist", whitelist); DefaultPermissions.registerPermission(PREFIX + "whitelist.list", "Allows the user to list all the users on the server whitelist", whitelist); whitelist.recalculatePermissibles(); return whitelist; }