Example #1
0
  /**
   * Checks to see if item ever equals the given jobs permits, or if the permit contains ALL or
   * NOTHING.
   *
   * @param item The item to check a match for.
   * @param job The job whose permits are being checked.
   * @param type The type of permit to check.
   * @return A Boolean value representative of the presence of a match.
   */
  public Boolean checkMatch(String item, String player, String type) {
    String job = getJob(player);
    Boolean matched = false;
    List<String> values = config.getStringList("config.all." + type, null);

    if (values != null) {
      for (String val : values) {
        if (val.equalsIgnoreCase("NOTHING")) {
          break;
        } else if (val.equalsIgnoreCase(item) || val.equalsIgnoreCase("ALL")) {
          matched = true;
          break;
        }
      }
    }

    values = config.getStringList("config.jobs." + job + "." + type, null);

    if (values != null) {
      for (String val : values) {
        if (val.equalsIgnoreCase("NOTHING")) {
          matched = false;
          break;
        } else if (val.equalsIgnoreCase(item) || val.equalsIgnoreCase("ALL")) {
          matched = true;
          break;
        }
      }
    }

    return matched;
  }
 @Override
 public List<String> getGroups(String player) {
   List<String> playerGroups = c.getStringList("players." + player, null);
   if (playerGroups == null || playerGroups.size() == 0) {
     return getDefaultArrayList();
   }
   return playerGroups;
 }
 @Override
 public void removeGroup(String player, String group) {
   List<String> playerGroups = c.getStringList("players." + player, null);
   if (playerGroups.contains(group)) {
     playerGroups.remove(group);
     log("Group:" + group + " removed from player:" + player + " in world:" + world.getName());
   } else {
     log(
         "Group:"
             + group
             + " could not be removed from player:"
             + player
             + " in world:"
             + world.getName()
             + " as the player does not have this group");
     return;
   }
   c.setProperty("players." + player, playerGroups);
   c.save();
   setupPlayers();
 }
 @Override
 public List<String> getGroupNodes(String group) {
   List<String> groupNodes = c.getStringList("groups." + group, null);
   return groupNodes;
 }