Package de.bananaco.permissions.util

Examples of de.bananaco.permissions.util.Group


      System.err.println("[bPermissions] Some silly developer is checking for a blank world!");
      return "BLANKWORLD";
    }
   
    WorldPermissions perms = wpm.getPermissionSet(world).getWorldPermissions();
    Group gr = perms.getGroup(group);
    if(gr.contains(valueToGet))
      return gr.getValue(valueToGet);
   
    String value = "";
    int priority = -1;
    for (Permission perm : gr.getEffectivePermissions()) {
      if (perm.isTrue()) {
        String name = perm.name();
        String[] index = name.split("\\.", 3);
        if (index.length == 3 && index[0].equals(valueToGet)) {
          int pr = Integer.parseInt(index[1]);
          if (pr > priority) {
            value = index[2];
            priority = pr;
          }
        }
      }
    }
    gr.setValue(valueToGet, value);
    return value;
  }
View Full Code Here


            + PERMISSIONS);
        List<String> nGroup = groupsConfig.getStringList(name + "."
            + GROUPS);
        Set<Permission> perms = Permission.loadFromString(nPerm);
        // Create the new group
        this.add(new Group(name, nGroup, perms, this));
      }

    }

    for (User user : getUsers()) {
View Full Code Here

            + PERMISSIONS);
        List<String> nGroup = groupsConfig.getStringList(name + "."
            + GROUPS);
        Set<Permission> perms = Permission.loadFromString(nPerm);
        // Create the new group
        this.add(new Group(name, nGroup, perms, this));
      }

    }

    for (User user : getUsers()) {
View Full Code Here

          }
        }
     
      if (groupsList != null)
        for (String group : groupsList) {
          Group gr = wp.getGroup(group);
          try {
          List<String> p = gConfig.getStringList("groups."+group+".permissions");
          List<String> i = gConfig.getStringList("groups."+group+".inheritance");
         
          if(p != null)
            gr.getPermissions().addAll(Permission.loadFromString(p));
          if(i != null)
            gr.getGroupsAsString().addAll(i);
          } catch (Exception e) {
            System.err.println("Error importing group: "+group);
          }
        }
      wp.save();
View Full Code Here

    return new ArrayList(getUsersAsString());
  }

  public Group getGroup(String name) {
    if (!groups.containsKey(name)) {
      Group gr = new Group(name, null, null, this);
      add(gr);
      gr.calculateEffectivePermissions();
    }
    return groups.get(name);
  }
View Full Code Here

  public abstract void save();

  @Override
  public void setGroupGroups(String group, List<String> groups) {
    Group gr = getGroup(group);
    Set<String> grgr = gr.getGroupsAsString();
    grgr.clear();
    grgr.addAll(groups);
    gr.calculateEffectivePermissions();
    save();
    gr.clearValues();
    log(parse(groups) + " set to group:" + group);
    MCMA.getDebugger().log(getWorld().getName());
    setupPlayers();
  }
View Full Code Here

    setupPlayer(player);
  }

  @Override
  public void setNodes(String group, List<String> nodes) {
    Group gr = getGroup(group);
    Set<Permission> pr = gr.getPermissions();
    pr.clear();
    pr.addAll(Permission.loadFromString(nodes));
    gr.calculateEffectivePermissions();
    save();
    gr.clearValues();
    log(parse(nodes) + " set to group:" + group);
    MCMA.getDebugger().log(getWorld().getName());
    setupPlayers();
  }
View Full Code Here

TOP

Related Classes of de.bananaco.permissions.util.Group

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.