Package dev.majek.pc.data.object
Class Party
- java.lang.Object
-
- dev.majek.pc.data.object.Party
-
public class Party extends Object
A party. Storing things such as members, the leader, and party config options.
-
-
Constructor Summary
Constructors Constructor Description Party(String partyName, String leaderUUID, List<User> members, Boolean isPublic, Boolean friendlyFire)
Constructed when a party is recreated after restart.Party(org.bukkit.entity.Player leader, String partyName)
Constructed when an online player creates a new party.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBlockedPlayer(org.bukkit.entity.Player player)
Add a player to the list of temporarily blocked players.void
addMember(User user)
Add a new party member.void
addPendingInvitation(org.bukkit.entity.Player invited, org.bukkit.entity.Player inviter)
Add a player to the list of pending invitations.void
addPendingJoinRequest(org.bukkit.entity.Player player)
Add a player to the list of pending join requests.void
addPendingSummons(org.bukkit.entity.Player player)
Add a player to the list of players with pending summon requests.boolean
allowsFriendlyFire()
Get whether the party allows friendly fire between members.List<org.bukkit.entity.Player>
getBlockedPlayers()
Get a list of players who are temporarily blocked from requesting to join the party.UUID
getId()
Get the party's unique id.User
getLeader()
Get the unique id of the party leader.List<User>
getMembers()
Get a list of the party member's unique ids.String
getName()
Get the party's name.List<Pair<org.bukkit.entity.Player,org.bukkit.entity.Player>>
getPendingInvitations()
Get a list of players who have pending invitations.List<org.bukkit.entity.Player>
getPendingJoinRequests()
Get a list of players who have pending join requests.List<org.bukkit.entity.Player>
getPendingSummons()
Get a list of players who have pending summon requests from the party leader.String
getRawName()
Get the party's name without color codes.int
getSize()
Get the size of the party.boolean
isPublic()
Get party status: public or private.void
removeBlockedPlayer(org.bukkit.entity.Player player)
Remove a player from the list of temporarily blocked players.void
removeMember(User user)
Remove a party member.void
removePendingInvitation(org.bukkit.entity.Player player)
Remove a player from the list of pending invitations.void
removePendingJoinRequest(org.bukkit.entity.Player player)
Remove a player from the list of pending join requests.void
removePendingSummons(org.bukkit.entity.Player player)
Remove a player from the list of players with pending summon requests.void
setFriendlyFire(boolean friendlyFire)
Set the party's friendly fire toggle.void
setLeader(User leader)
Set a new party leader.void
setName(String name)
Set the party's name.void
setPublic(boolean isPublic)
Set the public status.
-
-
-
Constructor Detail
-
Party
public Party(org.bukkit.entity.Player leader, String partyName)
Constructed when an online player creates a new party.- Parameters:
leader
- The online player creating the party.partyName
- The provided party name.
-
Party
public Party(String partyName, String leaderUUID, List<User> members, Boolean isPublic, Boolean friendlyFire)
Constructed when a party is recreated after restart.- Parameters:
partyName
- The name of the party.leaderUUID
- The leader of the party's unique id.members
- The list of party members.isPublic
- Whether the party is public.friendlyFire
- Whether the party allows friendly fire.
-
-
Method Detail
-
getName
public String getName()
Get the party's name.- Returns:
- Party name.
-
getRawName
public String getRawName()
Get the party's name without color codes.- Returns:
- Raw party name.
-
setName
public void setName(String name)
Set the party's name.- Parameters:
name
- New name.
-
getId
public UUID getId()
Get the party's unique id.- Returns:
- Party id.
-
getMembers
public List<User> getMembers()
Get a list of the party member's unique ids.- Returns:
- List of members.
-
addMember
public void addMember(User user)
Add a new party member.- Parameters:
user
- New user.
-
removeMember
public void removeMember(User user)
Remove a party member.- Parameters:
user
- User to remove.
-
getSize
public int getSize()
Get the size of the party.- Returns:
- Party size.
-
isPublic
public boolean isPublic()
Get party status: public or private.- Returns:
- true if public | false if private
-
setPublic
public void setPublic(boolean isPublic)
Set the public status.- Parameters:
isPublic
- Whether the party should be public.
-
allowsFriendlyFire
public boolean allowsFriendlyFire()
Get whether the party allows friendly fire between members.- Returns:
- true if allows | false if denies
-
setFriendlyFire
public void setFriendlyFire(boolean friendlyFire)
Set the party's friendly fire toggle.- Parameters:
friendlyFire
- Whether the party should allow friendly fire.
-
getLeader
public User getLeader()
Get the unique id of the party leader.- Returns:
- Party leader's unique id.
-
setLeader
public void setLeader(User leader)
Set a new party leader.- Parameters:
leader
- New leader's unique id.
-
getPendingJoinRequests
public List<org.bukkit.entity.Player> getPendingJoinRequests()
Get a list of players who have pending join requests. These are players who have requested to join the party.- Returns:
- List of players.
-
addPendingJoinRequest
public void addPendingJoinRequest(org.bukkit.entity.Player player)
Add a player to the list of pending join requests.- Parameters:
player
- Player to add.
-
removePendingJoinRequest
public void removePendingJoinRequest(org.bukkit.entity.Player player)
Remove a player from the list of pending join requests.- Parameters:
player
- Player to remove.
-
getPendingInvitations
public List<Pair<org.bukkit.entity.Player,org.bukkit.entity.Player>> getPendingInvitations()
Get a list of players who have pending invitations. These are players who have been invited to join the party.- Returns:
- List of players.
-
addPendingInvitation
public void addPendingInvitation(org.bukkit.entity.Player invited, org.bukkit.entity.Player inviter)
Add a player to the list of pending invitations.- Parameters:
invited
- Player to add.inviter
- The player inviting the other player.
-
removePendingInvitation
public void removePendingInvitation(org.bukkit.entity.Player player)
Remove a player from the list of pending invitations.- Parameters:
player
- Player to remove.
-
getBlockedPlayers
public List<org.bukkit.entity.Player> getBlockedPlayers()
Get a list of players who are temporarily blocked from requesting to join the party.- Returns:
- List of players.
-
addBlockedPlayer
public void addBlockedPlayer(org.bukkit.entity.Player player)
Add a player to the list of temporarily blocked players.- Parameters:
player
- Player to add.
-
removeBlockedPlayer
public void removeBlockedPlayer(org.bukkit.entity.Player player)
Remove a player from the list of temporarily blocked players.- Parameters:
player
- Player to remove.
-
getPendingSummons
public List<org.bukkit.entity.Player> getPendingSummons()
Get a list of players who have pending summon requests from the party leader.- Returns:
- List of players.
-
addPendingSummons
public void addPendingSummons(org.bukkit.entity.Player player)
Add a player to the list of players with pending summon requests.- Parameters:
player
- Player to add.
-
removePendingSummons
public void removePendingSummons(org.bukkit.entity.Player player)
Remove a player from the list of players with pending summon requests.- Parameters:
player
- Player to remove.
-
-