Package de.bananaco.permissions.worlds

Examples of de.bananaco.permissions.worlds.WorldPermissions


    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();
    Group gr = perms.getGroup(group);
    if(gr.contains(valueToGet))
      return gr.getValue(valueToGet);
   
    String value = "";
    int priority = -1;
View Full Code Here


    // Blame CraftIRC
    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;
View Full Code Here

  public void importPermissions3() {

    WorldPermissionsManager wpm = Permissions.getWorldPermissionsManager();
    for (World world : plugin.getServer().getWorlds()) {
      PermissionSet ps = wpm.getPermissionSet(world);
      WorldPermissions wp = ps.getWorldPermissions();
     
      File users = new File("plugins/Permissions/" + world.getName()
          + "/users.yml");
      File groups = new File("plugins/Permissions/" + world.getName()
          + "/groups.yml");
     
      YamlConfiguration uConfig = new YamlConfiguration();
      YamlConfiguration gConfig = new YamlConfiguration();
      try {
      uConfig.load(users);
      gConfig.load(groups);
      } catch (Exception e) {
        e.printStackTrace();
      }
      ConfigurationSection usConfig = uConfig.getConfigurationSection("users");
      ConfigurationSection grConfig = gConfig.getConfigurationSection("groups");
     
      Set<String> usersList = null;
      if(usConfig != null)
        usersList = usConfig.getKeys(false);
      Set<String> groupsList = null;
      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);
          }
        }
     
      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

TOP

Related Classes of de.bananaco.permissions.worlds.WorldPermissions

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.