Class Party

java.lang.Object
net.ognetwork.ogcore.api.models.Party

public class Party extends Object
A redis implementation of the Party. This allows any server to control the state of a party, whether from the Bungee side, or the Spigot side.
  • Field Details

  • Constructor Details

    • Party

      public Party(UUID playerUuid)
      Creates a party instance for a specific player. If the player is in a party, that party will be the result of this call. If the player is not in a party, a new party will be created with this player as the leader.
      Parameters:
      playerUuid - The uuid of the player
    • Party

      public Party(Player player)
      Creates a party instance for a specific player. If the player is in a party, that party will be the result of this call. If the player is not in a party, a new party will be created with this player as the leader.
      Parameters:
      player - The player
    • Party

      public Party(String redisKey)
      Creates a party instance based on a known party key. If the key does not exist, then a party is created with this key.
      Parameters:
      redisKey - The redis key corresponding to this party.
  • Method Details

    • getPartyKey

      public String getPartyKey()
      Gets the party key.
      Returns:
      The party key
    • getMemberUuids

      public List<UUID> getMemberUuids()
      Gets the members of the party.
      Returns:
      The player's UUIDs who are in the party (includes all players, including the disconnected players).
    • getLeaderUuid

      public UUID getLeaderUuid()
      Gets the uuid of the party leader.
      Returns:
      The uuid of the party leader.
    • getSize

      public int getSize()
      Gets the size of the party. This is based on the number of people in the party.
      Returns:
      The number of players in the party (includes all players, including the disconnected players).
    • isLeader

      public boolean isLeader(UUID playerUuid)
      Checks if the player is the party leader.
      Parameters:
      playerUuid - The uuid of the player to check.
      Returns:
      true if the player is the leader, otherwise false.
    • isLeader

      public boolean isLeader(Player player)
      Checks if the player is the party leader.
      Parameters:
      player - The player to check.
      Returns:
      true if the player is the leader, otherwise false.
    • isMember

      public boolean isMember(UUID playerUuid)
      Checks if the player is a party member.
      Parameters:
      playerUuid - The uuid of the player to check.
      Returns:
      true if the player is a member, otherwise false.
    • isMember

      public boolean isMember(Player player)
      Checks if the player is a party member.
      Parameters:
      player - The player to check.
      Returns:
      true if the player is a member, otherwise false.
    • isInvited

      public boolean isInvited(UUID playerUuid)
      Checks if the player is invited.
      Parameters:
      playerUuid - The uuid of the player to check.
      Returns:
      true if the player is invited, otherwise false.
    • isInvited

      public boolean isInvited(Player player)
      Checks if the player is invited.
      Parameters:
      player - The player to check.
      Returns:
      true if the player is invited, otherwise false.
    • isPublic

      public boolean isPublic()
      Gets if the party is public and anyone can join.
      Returns:
      true if the party is public, otherwise false.
    • declineInviteForceful

      public void declineInviteForceful(UUID playerUuid)
      Force an invite to be declined for a player. No checks are performed for this call.
      Parameters:
      playerUuid - The uuid of the player to decline the invite
    • declineInvite

      public Party.ResultStatus declineInvite(UUID playerUuid)
      Tries to make a player decline a party invite.
      Parameters:
      playerUuid - The uuid of the player to decline.
      Returns:
      Party.ResultStatus.OK if the player declined successfully. Party.ResultStatus.NOT_INVITED if the player was not invited to the party.
    • declineInvite

      public Party.ResultStatus declineInvite(Player player)
      Tries to make a player decline a party invite.
      Parameters:
      player - The player to decline.
      Returns:
      Party.ResultStatus.OK if the player declined successfully. Party.ResultStatus.NOT_INVITED if the player was not invited to the party.
    • disband

      public void disband()
      Forces a party to be disbanded. No checks are performed for this call.
    • disband

      public Party.ResultStatus disband(UUID playerUuid)
      Tries to disband a party as a player.
      Parameters:
      playerUuid - The uuid of the player to disband the party.
      Returns:
      Party.ResultStatus.OK if the party disbanded successfully. Party.ResultStatus.NO_PERMISSION if the user did not have permission.
    • disband

      public Party.ResultStatus disband(Player player)
      Tries to disband a party as a player.
      Parameters:
      player - The player to disband the party.
      Returns:
      Party.ResultStatus.OK if the party disbanded successfully. Party.ResultStatus.NO_PERMISSION if the user did not have permission.
    • invite

      public void invite(UUID playerUuid)
      Forces the player to be invited to the party. This is a forceful action. No checks are performed for this call.
      Parameters:
      playerUuid - The uuid of the player to be invited to the party.
    • invite

      public Party.ResultStatus invite(UUID actingPlayerUuid, UUID inviteePlayerUuid)
      Tries to invite a player to the party.
      Parameters:
      actingPlayerUuid - The uuid of the player who is trying to invite the inviteePlayer.
      inviteePlayerUuid - The uuid of the player who is being invited.
      Returns:
      Party.ResultStatus.OK if the player joined successfully. Party.ResultStatus.PARTY_FULL if the party is full. Party.ResultStatus.ALREADY_INVITED if the player was already invited. Party.ResultStatus.IS_MEMBER if the player is already a member. Party.ResultStatus.NO_PERMISSION if the actingPlayer can not invite the inviteePlayer to the party.
    • invite

      public Party.ResultStatus invite(Player actingPlayer, UUID inviteePlayerUuid)
      Tries to invite a player to the party.
      Parameters:
      actingPlayer - The player who is trying to invite the inviteePlayer.
      inviteePlayerUuid - The uuid of the player who is being invited.
      Returns:
      Party.ResultStatus.OK if the player joined successfully. Party.ResultStatus.PARTY_FULL if the party is full. Party.ResultStatus.ALREADY_INVITED if the player was already invited. Party.ResultStatus.IS_MEMBER if the player is already a member. Party.ResultStatus.NO_PERMISSION if the actingPlayer can not invite the inviteePlayer to the party.
    • invite

      public Party.ResultStatus invite(Player actingPlayer, Player inviteePlayer)
      Tries to invite a player to the party.
      Parameters:
      actingPlayer - The player who is trying to invite the inviteePlayer.
      inviteePlayer - The player who is being invited.
      Returns:
      Party.ResultStatus.OK if the player joined successfully. Party.ResultStatus.PARTY_FULL if the party is full. Party.ResultStatus.ALREADY_INVITED if the player was already invited. Party.ResultStatus.IS_MEMBER if the player is already a member. Party.ResultStatus.NO_PERMISSION if the actingPlayer can not invite the inviteePlayer to the party.
    • joinForceful

      public void joinForceful(UUID playerUuid)
      Forces a player to join a party. This ignores any checks from the normal join function join(java.util.UUID).
      Parameters:
      playerUuid - The uuid of the player to join the party.
    • join

      public Party.ResultStatus join(UUID playerUuid)
      Tries to make a player join a party. If the player is already in a party, this will make the player leave the existing party in favor of the new one.
      Parameters:
      playerUuid - The uuid of the player to join.
      Returns:
      Party.ResultStatus.OK if the player joined successfully. Party.ResultStatus.PARTY_FULL if the party is full. Party.ResultStatus.NOT_INVITED if the player was not invited to the party.
    • join

      public Party.ResultStatus join(Player player)
      Tries to make a player join a party. If the player is already in a party, this will make the player leave the existing party in favor of the new one.
      Parameters:
      player - The player to join.
      Returns:
      Party.ResultStatus.OK if the player joined successfully. Party.ResultStatus.PARTY_FULL if the party is full. Party.ResultStatus.NOT_INVITED if the player was not invited to the party.
    • kickMember

      public void kickMember(UUID playerUuid)
      Forces a player to be kicked from the party. This ignores any checks from the normal kickMember function. kickMember(java.util.UUID, java.util.UUID).
      Parameters:
      playerUuid - The uuid of the player to kick.
    • kickMember

      public Party.ResultStatus kickMember(UUID actingPlayerUuid, UUID kickeePlayerUuid)
      Tries to kick a user from the party.
      Parameters:
      actingPlayerUuid - The uuid of the player who is trying to kick the player from the party
      kickeePlayerUuid - The uuid of the player who is going to be kicked from the party
      Returns:
      Party.ResultStatus.OK if the player became was kicked successfully. Party.ResultStatus.IS_LEADER if the kickeePlayer is the leader. Party.ResultStatus.NO_PERMISSION if the actingPlayer can not kick the kickeePlayer from the party.
    • kickMember

      public Party.ResultStatus kickMember(Player actingPlayer, UUID kickeePlayerUuid)
      Tries to kick a user from the party.
      Parameters:
      actingPlayer - The player who is trying to kick the player from the party
      kickeePlayerUuid - The uuid of the player who is going to be kicked from the party
      Returns:
      Party.ResultStatus.OK if the player became was kicked successfully. Party.ResultStatus.IS_LEADER if the kickeePlayer is the leader. Party.ResultStatus.NO_PERMISSION if the actingPlayer can not kick the kickeePlayer from the party.
    • kickMember

      public Party.ResultStatus kickMember(Player actingPlayer, Player kickeePlayer)
      Tries to kick a user from the party.
      Parameters:
      actingPlayer - The player who is trying to kick the player from the party.
      kickeePlayer - The player who is going to be kicked from the party.
      Returns:
      Party.ResultStatus.OK if the player became was kicked successfully. Party.ResultStatus.IS_LEADER if the kickeePlayer is the leader. Party.ResultStatus.NO_PERMISSION if the actingPlayer can not kick the kickeePlayer from the party.
    • makeLeader

      public void makeLeader(UUID playerUuid)
      Forces a player to become to party leader. This ignores any checks from the normal makeLeader function. makeLeader(java.util.UUID, java.util.UUID).
      Parameters:
      playerUuid - The uuid of the player to make the leader.
    • makeLeader

      public Party.ResultStatus makeLeader(UUID actingPlayerUuid, UUID promoteePlayerUuid)
      Tries to make a user the leader of the party.
      Parameters:
      actingPlayerUuid - The uuid of the player who is trying to make the promotee the leader.
      promoteePlayerUuid - The uuid of the player who is going to become the leader.
      Returns:
      Party.ResultStatus.OK if the player became the leader successfully. Party.ResultStatus.NO_PERMISSION if the actingPlayer can not promote the promoteePlayer to the party.
    • makeLeader

      public Party.ResultStatus makeLeader(Player actingPlayer, UUID promoteePlayerUuid)
      Tries to make a user the leader of the party.
      Parameters:
      actingPlayer - The player who is trying to make the promotee the leader.
      promoteePlayerUuid - The uuid of the player who is going to become the leader
      Returns:
      Party.ResultStatus.OK if the player became the leader successfully. Party.ResultStatus.NO_PERMISSION if the actingPlayer can not promote the promoteePlayer to the party.
    • makeLeader

      public Party.ResultStatus makeLeader(Player actingPlayer, Player promoteePlayer)
      Tries to make a user the leader of the party.
      Parameters:
      actingPlayer - The player who is trying to make the promotee the leader.
      promoteePlayer - The player who is going to become the leader
      Returns:
      Party.ResultStatus.OK if the player became the leader successfully. Party.ResultStatus.NO_PERMISSION if the actingPlayer can not promote the promoteePlayer to the party.
    • makePublic

      public void makePublic()
      Forces the party to become a public party.
    • makePublic

      public Party.ResultStatus makePublic(UUID actingPlayerUuid)
      Tries to make a party public.
      Parameters:
      actingPlayerUuid - The uuid of the player trying to make the party public.
      Returns:
      Party.ResultStatus.OK if the party became public successfully. Party.ResultStatus.NO_PERMISSION if the actingPlayer can not make the party public.
    • makePublic

      public Party.ResultStatus makePublic(Player actingPlayer)
      Tries to make a party public.
      Parameters:
      actingPlayer - The player trying to make the party public.
      Returns:
      Party.ResultStatus.OK if the party became public successfully. Party.ResultStatus.NO_PERMISSION if the actingPlayer can not make the party public.
    • makePrivate

      public void makePrivate()
      Forces the party to become a private party.
    • makePrivate

      public Party.ResultStatus makePrivate(UUID actingPlayerUuid)
      Tries to make a party private.
      Parameters:
      actingPlayerUuid - The uuid of the player trying to make the party private.
      Returns:
      Party.ResultStatus.OK if the party became private successfully. Party.ResultStatus.NO_PERMISSION if the actingPlayer can not make the party private.
    • makePrivate

      public Party.ResultStatus makePrivate(Player actingPlayer)
      Tries to make a party private.
      Parameters:
      actingPlayer - The player trying to make the party private.
      Returns:
      Party.ResultStatus.OK if the party became private successfully. Party.ResultStatus.NO_PERMISSION if the actingPlayer can not make the party private.