FriendsPremium

Apr 20, 2021
FriendsPremium
  • [​IMG]


    To access the API of FriendsPremium you can either add the .jar-File to your buildpath or add the following dependency to your pom.xml:

    HTML:
            <repository>
                <id>FriendsAPI</id>
                <url>https://raw.githubusercontent.com/HyChrod/FriendsAPI/repository</url>
            </repository>

            <dependency>
                <groupId>de.HyChrod</groupId>
                <artifactId>FriendsAPI</artifactId>
                <version>1.1.0.9.1</version>
                <scope>provided</scope>
            </dependency>

    All data in Friends and Party is beeing fetched once on join and cached afterwards. That means you cannot access all data directly in the join events because the data might not be ready then.
    To make sure the data of a player has been fully fetched you can do the following:
    Code (Java):
            if(BungeeDataFetcher.isDataFetchedCompletly(uuid))
               
                or
               
            if(SpigotDataFetcher.isDataFetchedCompletly(uuid))




    All available methods accessable by FriendsAPI:

    Code (Java):

            // Returns list of all friends
            List<Friend> friends = FriendsAPI.getFriends(uuid);
           
            // Returns list with all friends currently online
            List<Friend> onlineFriends = FriendsAPI.getOnlineFriends(uuid);
           
            // Returns list with all friends currently offline
            List<Friend> offlineFriends = FriendsAPI.getOfflineFriends(uuid);
           
            // Returns list with all friends marked as favorite
            List<Friend> favoriteFriends = FriendsAPI.getFavoriteFriends(uuid);
           
            // Gets a friendship between two players by their uuid
            Friend friendWithUUID = FriendsAPI.getFriend(uuid, friendUUID);
           
            // Gets a friendship between two players by uuid and name
            Friend friendWithName = FriendsAPI.getFriend(uuid, friendName);
           
            // Gets all options from a player by uuid
            Options options = FriendsAPI.getOptions(uuid);
           
            // Gets a list of all open requests
            List<Request> requests = FriendsAPI.getRequests(uuid);
           
            // Gets a request by uuid
            Request requestWithUUID = FriendsAPI.getRequest(uuid, requesterUUID);
           
            // Gets a request by uuid and name
            Request requestWithName = FriendsAPI.getRequest(uuid, requesterName);
           
            // Sends a request to uuidToSendTo
            // This method can only be accessed by bungeecord!
            FriendsAPI.sendRequest(uuidToSendTo, uuidSender, nameSender, "optionalAddMessage can be null");
           
            /**
            * Friend is a class containing alot of usefull informations
            * describing the friendship between two players
            */

            Friend friend = FriendsAPI.getFriend(aUUID, bUUID);
            // Checks if a has b set to favorite
            if(friend.getFavorite() == 1)
            // Checks if b is allowed to send a messages
            if(friend.getCanSendMessages() == 1)
            // Gets the time in millis b was last seen on the server
            long lastOnline = friend.getLastOnline();
            // Gets the set nickname of b
            String nickname = friend.getNickname();
            // [0,1] if online or not
            int online = friend.getOnline();
            String server = friend.getServer();
            String status = friend.getStatus();
     

    All available methods accessable by PartyAPI:

    Code (Java):
            // Return the current party a player is in
            // Returns null if the player is currently in no party
            Partydata party = PartyAPI.getParty(uuid);
           
            // Returns a list of all members in the current party
            List<Member> members = PartyAPI.getMembers(uuid);
           
            // Returns a list of all partyleaders in the current party
            List<Member> leaders = PartyAPI.getPartyLeaders(uuid);
           
            // Gives a single member in the party by uuid or name
            Member member = party.getSingle(uuid);
            Member member = party.getSingle(name);
           
            // Gets the current sever the party is on
            String server = party.getServer();
           
            // To validate if a member is a leader of the current party
            if(member.getLeader() == 1)
  • Loading...
  • Loading...