Ver Fonte

Add function to get a list of all players in a party to the API.

GJ há 12 anos atrás
pai
commit
200ac53078
1 ficheiros alterados com 13 adições e 2 exclusões
  1. 13 2
      src/main/java/com/gmail/nossr50/api/PartyAPI.java

+ 13 - 2
src/main/java/com/gmail/nossr50/api/PartyAPI.java

@@ -125,8 +125,7 @@ public final class PartyAPI {
      * @return all the players in the player's party
      * @deprecated
      */
-    // TODO: I naively tried to add another getAllMembers that returns a List<OffflinePlayer>, but that wasn't possible
-    // since the return type isn't part of the the method's signature. If anybody has an idea...
+    @Deprecated
     public static List<String> getAllMembers(Player player) {
         List<String> memberNames = new ArrayList<String>();
 
@@ -137,6 +136,18 @@ public final class PartyAPI {
         return memberNames;
     }
 
+    /**
+     * Get a list of all players in this player's party.
+     * </br>
+     * This function is designed for API usage.
+     *
+     * @param player The player to check
+     * @return all the players in the player's party
+     */
+    public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
+        return PartyManager.getAllMembers(player);
+    }
+
     /**
      * Get a list of all online players in this party.
      * </br>