Package de.bananaco.permissions.util

Examples of de.bananaco.permissions.util.User


    if (world == null || world.equals("")) {
      System.err.println("[bPermissions] Some silly developer is checking for a blank world!");
      return "BLANKWORLD";
    }
    WorldPermissions perms = wpm.getPermissionSet(world).getWorldPermissions();
    User us = perms.getUser(player);
    if(us.contains(valueToGet))
      return us.getValue(valueToGet);
   
    String value = "";
    int priority = -1;
    for (Permission perm : us.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;
          }
        }
      }
    }
    us.setValue(valueToGet, value);
    return value;
  }
View Full Code Here


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

    }

    ConfigurationSection groupsConfig = config
View Full Code Here

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

    }

    ConfigurationSection groupsConfig = gconfig
View Full Code Here

      if(grConfig != null)
        groupsList = grConfig.getKeys(false);
     
      if (usersList != null)
        for (String player : usersList) {
          User user = wp.getUser(player);
          try {
          List<String> p = uConfig.getList("users."+player+".permissions");
          List<String> i = uConfig.getList("users."+player+".groups");
         
          if(p != null)
            user.getPermissions().addAll(Permission.loadFromString(p));
          if(i != null) {
            user.getGroupsAsString().clear();
            user.getGroupsAsString().addAll(i);
          }
          } catch (Exception e) {
            System.err.println("Error importing user: "+player);
          }
        }
View Full Code Here

  }
 
  public static boolean has(String player, String world, String node) {
    node = node.toLowerCase();
    WorldPermissions wp = Permissions.getWorldPermissionsManager().getPermissionSet(world).getWorldPermissions();
    User user = wp.getUser(player);
    Map<String, Boolean> perms = user.getMappedPermissions();
   
    if(perms.containsKey(node))
      return perms.get(node);
   
    String permission = node;
View Full Code Here

    return getUser(player).getEffectivePermissions();
  }

  public User getUser(String name) {
    if (!users.containsKey(name)) {
      User us = new User(name, getDefaultArrayList(), null, this);
      add(us);
      us.calculateEffectivePermissions();
    }
    return users.get(name);
  }
View Full Code Here

    setupPlayers();
  }

  @Override
  public void setGroups(String player, List<String> groups) {
    User us = getUser(player);
    Set<String> gr = us.getGroupsAsString();
    gr.clear();
    gr.addAll(groups);
    us.calculateEffectivePermissions();
    save();
    us.clearValues();
    log(parse(groups) + " set to player:" + player);
    MCMA.getDebugger().log(getWorld().getName());
    setupPlayer(player);
  }
View Full Code Here

    setupPlayers();
  }

  @Override
  public void setPlayerNodes(String player, List<String> nodes) {
    User us = getUser(player);
    Set<Permission> pr = us.getPermissions();
    pr.clear();
    pr.addAll(Permission.loadFromString(nodes));
    us.calculateEffectivePermissions();
    save();
    us.clearValues();
    log(parse(nodes) + " set to player:" + player);
    MCMA.getDebugger().log(getWorld().getName());
    setupPlayer(player);
  }
View Full Code Here

TOP

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

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.