Пример #1
0
 @Override
 public boolean groupHas(String world, String group, String permission) {
   GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world));
   if (set.hasGroup(group)) {
     Group g = set.getGroup(group);
     return g.hasPermission(permission, true);
   } else {
     return false;
   }
 }
Пример #2
0
  @Override
  public boolean playerHas(String world, String player, String permission) {
    OfflinePlayer op = Bukkit.getOfflinePlayer(player);

    if (op.isOnline()) {
      Player p = (Player) op;
      if (p.getWorld().getName().equalsIgnoreCase(world)) {
        return p.hasPermission(permission);
      }
    }

    GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world));
    Group user = set.getUser(op);
    return user.hasPermission(permission, true);
  }
Пример #3
0
  @Override
  public boolean groupRemove(String world, String group, String permission) {
    GroupManager gm = perms.getGroupManager();
    GroupSet set = gm.getWorldSet(Bukkit.getWorld(world));
    if (set.hasGroup(group)) {
      Group g = set.getGroup(group);

      boolean value = !permission.startsWith("^");
      permission = value ? permission : permission.substring(1);

      if (g.hasPermission(permission, false)) {
        g.removePermission(permission, true);

        for (User user : gm.getAffectedUsers(g)) {
          user.applyPermissions(gm.getFactory());
        }
        return true;
      } else {
        return false;
      }
    } else {
      return false;
    }
  }