Exemplo n.º 1
0
 private String uuidSetToString(DefaultDomain domain) {
   UUIDControl uuidControl = SlapPlayers.getUUIDController();
   Set<UUID> set = domain.getUniqueIds();
   if (set.isEmpty()) {
     return ChatColor.RED + "(none)";
   } else {
     HashSet<String> names = new HashSet<>();
     for (UUID owner : domain.getUniqueIds()) {
       names.add(uuidControl.getProfile(owner).getCurrentName());
     }
     return ChatColor.YELLOW + Util.buildString(names, ", ");
   }
 }
Exemplo n.º 2
0
  /**
   * Get the default number of homes for a player
   *
   * @param userID The player's ID
   * @return default number of homes
   */
  private int getDefaultNumberOfHomes(int userID) {
    UUID uuid = UUID.fromString(SlapPlayers.getUUIDController().getProfile(userID).getUUIDString());
    PermissionUser user = PermissionsEx.getPermissionManager().getUser(uuid); // Get user
    if (user == null) return 0; // If user is null, return 0

    // Loop through groups to find highest value
    int nrOfHomes = 0;
    for (String group : user.getGroupNames()) {
      if (defaultNumberOfHomes.containsKey(group)) {
        int foundHomes = defaultNumberOfHomes.get(group);
        if (nrOfHomes < foundHomes) {
          nrOfHomes = foundHomes;
        }
      }
    }
    return nrOfHomes;
  }