Package net.ognetwork.ogcore.api.models
Class Party
java.lang.Object
net.ognetwork.ogcore.api.models.Party
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The possible results of different actions performed by users. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondeclineInvite
(UUID playerUuid) Tries to make a player decline a party invite.declineInvite
(Player player) Tries to make a player decline a party invite.void
declineInviteForceful
(UUID playerUuid) Force an invite to be declined for a player.void
disband()
Forces a party to be disbanded.Tries to disband a party as a player.Tries to disband a party as a player.Gets the uuid of the party leader.Gets the members of the party.Gets the party key.int
getSize()
Gets the size of the party.void
Forces the player to be invited to the party.Tries to invite a player to the party.Tries to invite a player to the party.Tries to invite a player to the party.boolean
Checks if the player is invited.boolean
Checks if the player is invited.boolean
Checks if the player is the party leader.boolean
Checks if the player is the party leader.boolean
Checks if the player is a party member.boolean
Checks if the player is a party member.boolean
isPublic()
Gets if the party is public and anyone can join.Tries to make a player join a party.Tries to make a player join a party.void
joinForceful
(UUID playerUuid) Forces a player to join a party.void
kickMember
(UUID playerUuid) Forces a player to be kicked from the party.kickMember
(UUID actingPlayerUuid, UUID kickeePlayerUuid) Tries to kick a user from the party.kickMember
(Player actingPlayer, UUID kickeePlayerUuid) Tries to kick a user from the party.kickMember
(Player actingPlayer, Player kickeePlayer) Tries to kick a user from the party.void
makeLeader
(UUID playerUuid) Forces a player to become to party leader.makeLeader
(UUID actingPlayerUuid, UUID promoteePlayerUuid) Tries to make a user the leader of the party.makeLeader
(Player actingPlayer, UUID promoteePlayerUuid) Tries to make a user the leader of the party.makeLeader
(Player actingPlayer, Player promoteePlayer) Tries to make a user the leader of the party.void
Forces the party to become a private party.makePrivate
(UUID actingPlayerUuid) Tries to make a party private.makePrivate
(Player actingPlayer) Tries to make a party private.void
Forces the party to become a public party.makePublic
(UUID actingPlayerUuid) Tries to make a party public.makePublic
(Player actingPlayer) Tries to make a party public.
-
Field Details
-
PARTY_PREFIX
- See Also:
-
PARTY_HELPER_MEMBERS
- See Also:
-
PARTY_HELPER_INVITED_MEMBERS
- See Also:
-
-
Constructor Details
-
Party
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
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
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
Gets the party key.- Returns:
- The party key
-
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Forces a player to join a party. This ignores any checks from the normal join functionjoin(java.util.UUID)
.- Parameters:
playerUuid
- The uuid of the player to join the party.
-
join
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
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
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
Tries to kick a user from the party.- Parameters:
actingPlayerUuid
- The uuid of the player who is trying to kick the player from the partykickeePlayerUuid
- 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
Tries to kick a user from the party.- Parameters:
actingPlayer
- The player who is trying to kick the player from the partykickeePlayerUuid
- 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
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
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
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
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
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
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
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
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
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.
-