API Examples

These are some examples that you can do with the Parties API:

Get player party

Player somePlayer;
PartiesAPI api = Parties.getApi();
String partyName = api.getPartyPlayer(somePlayer.getUniqueId()).getPartyName();

Change party description if empty

PartiesAPI api = Parties.getApi();
Party party = api.getParty("PartyName");
String description = party.getDescription();
if (description.isEmpty()) {
    party.setDescription("new description");

Create a party

Player leader; // You need a leader
PartiesAPI api = Parties.getApi();
boolean success = api.createParty("partyName", api.getPartyPlayer(leader.getUniqueId()));

Get party information upon creation

public void onPartyCreate(BukkitPartiesPartyPostCreateEvent event) {
    String description = event.getParty().getDescription();
    String prefix = event.getParty().getPrefix();
    // etc..

Get online parties

PartiesAPI api = Parties.getApi();
List<Party> list = api.getOnlineParties();