Package org.bukkit.permissions

Examples of org.bukkit.permissions.Permission


            this.plugin.getServer().getPluginManager().recalculatePermissionDefaults(parentPermission);
        }
    }

    private void addToRootPermission(String rootPerm, String permStringChopped) {
        Permission rootPermission = this.plugin.getServer().getPluginManager().getPermission(rootPerm);
        if (rootPermission == null) {
            rootPermission = new Permission(rootPerm);
            this.plugin.getServer().getPluginManager().addPermission(rootPermission);
        }
        rootPermission.getChildren().put(permStringChopped + ".*", true);
        this.plugin.getServer().getPluginManager().recalculatePermissionDefaults(rootPermission);
    }
View Full Code Here


     * @param defaultValue The default-value.
     * @return The permission as {@link Permission}.
     */
    public Permission addPermission(String string, PermissionDefault defaultValue) {
        if (this.plugin.getServer().getPluginManager().getPermission(string) == null) {
            Permission permission = new Permission(string, defaultValue);
            this.plugin.getServer().getPluginManager().addPermission(permission);
            this.addToParentPerms(string);
        }
        return this.plugin.getServer().getPluginManager().getPermission(string);
    }
View Full Code Here

        if (parentPermString == null) {
            addToRootPermission("*", permStringChopped);
            addToRootPermission("*.*", permStringChopped);
            return;
        }
        Permission parentPermission = this.plugin.getServer().getPluginManager().getPermission(parentPermString);
        // Creat parent and grandparents
        if (parentPermission == null) {
            parentPermission = new Permission(parentPermString);
            this.plugin.getServer().getPluginManager().addPermission(parentPermission);

            this.addToParentPerms(parentPermString);
        }
        // Create actual perm.
        Permission actualPermission = this.plugin.getServer().getPluginManager().getPermission(permString);
        // Extra check just to make sure the actual one is added
        if (actualPermission == null) {

            actualPermission = new Permission(permString);
            this.plugin.getServer().getPluginManager().addPermission(actualPermission);
        }
        if (!parentPermission.getChildren().containsKey(permString)) {
            parentPermission.getChildren().put(actualPermission.getName(), true);
            this.plugin.getServer().getPluginManager().recalculatePermissionDefaults(parentPermission);
        }
    }
View Full Code Here

            this.plugin.getServer().getPluginManager().recalculatePermissionDefaults(parentPermission);
        }
    }

    private void addToRootPermission(String rootPerm, String permStringChopped) {
        Permission rootPermission = this.plugin.getServer().getPluginManager().getPermission(rootPerm);
        if (rootPermission == null) {
            rootPermission = new Permission(rootPerm);
            this.plugin.getServer().getPluginManager().addPermission(rootPermission);
        }
        rootPermission.getChildren().put(permStringChopped + ".*", true);
        this.plugin.getServer().getPluginManager().recalculatePermissionDefaults(rootPermission);
    }
View Full Code Here

   * @param def value to use if the node is unusable
   * @param description to use if the node is unusable
   * @return Permission that was loaded
   */
  public final Permission loadPermission(ConfigurationNode node, PermissionDefault def, String description) {
    Permission permission = getPermission(node.getPath());
    permission.setDefault(node.get("default", def));
    permission.setDescription(node.get("description", description));
    return permission;
  }
View Full Code Here

      setPermissions(subNode);
    }
    PermissionDefault def = node.get("default", PermissionDefault.class);
    String desc = node.get("description", String.class);
    if (def != null || desc != null) {
      Permission permission = getPermission(node.getPath().toLowerCase());
      if (def != null) {
        permission.setDefault(def);
      }
      if (desc != null) {
        permission.setDescription(desc);
      }
    }
  }
View Full Code Here

    private DynmapLocation spawnloc = new DynmapLocation();
   
    public BukkitWorld(World w) {
        this(w.getName(), w.getMaxHeight(), w.getSeaLevel(), w.getEnvironment());
        setWorldLoaded(w);
        new Permission("dynmap.world." + getName(), "Dynmap access for world " + getName(), PermissionDefault.OP);
    }
View Full Code Here

    public BukkitWorld(String name, int height, int sealevel, World.Environment env) {
        super(name, height, sealevel);
        world = null;
        this.env = env;
        skylight = (env == World.Environment.NORMAL);
        new Permission("dynmap.world." + getName(), "Dynmap access for world " + getName(), PermissionDefault.OP);
        // Generate non-default environment lighting table
        switch (env) {
            case NETHER:
                {
                    float f = 0.1F;
View Full Code Here

        } else if (subcommand.equals("info")) {
            if (!checkPerm(sender, "info")) return true;
            if (split.length != 2) return usage(sender, command, subcommand);

            String node = split[1];
            Permission perm = plugin.getServer().getPluginManager().getPermission(node);

            if (perm == null) {
                sender.sendMessage(ChatColor.RED + "Permission " + ChatColor.WHITE + node + ChatColor.RED + " not found.");
            } else {
                sender.sendMessage(ChatColor.GREEN + "Info on permission " + ChatColor.WHITE + perm.getName() + ChatColor.GREEN + ":");
                sender.sendMessage(ChatColor.GREEN + "Default: " + ChatColor.WHITE + perm.getDefault());
                if (perm.getDescription() != null && perm.getDescription().length() > 0) {
                    sender.sendMessage(ChatColor.GREEN + "Description: " + ChatColor.WHITE + perm.getDescription());
                }
                if (perm.getChildren() != null && perm.getChildren().size() > 0) {
                    sender.sendMessage(ChatColor.GREEN + "Children: " + ChatColor.WHITE + perm.getChildren().size());
                }
                if (perm.getPermissibles() != null && perm.getPermissibles().size() > 0) {
                    int num = 0, numTrue = 0;
                    for (Permissible who : perm.getPermissibles()) {
                        ++num;
                        if (who.hasPermission(perm)) {
                            ++numTrue;
                        }
                    }
View Full Code Here

TOP

Related Classes of org.bukkit.permissions.Permission

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.