Package com.booksaw.betterTeams
Class Team
java.lang.Object
com.booksaw.betterTeams.Team
This class is used to manage a team and all of it's participants
- Author:
- booksaw
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidUsed to add an ally for this teamvoidvoidUsed to add an ally for this teamvoidaddAllyRequest(@Nullable Team team) Used to add an ally request to this teamvoidaddAllyRequest(UUID team) Used to add an ally request to this teamvoidaddClaim(org.bukkit.Location location) Used to add a chest claim to this teamvoidUsed for anchoring this player.voidbanPlayer(org.bukkit.OfflinePlayer player) This method is used to add a player to the list of players which are banned from the teamvoidbecomeNeutral(Team otherTeam, boolean sendPostEvent) Used to become neutral to a teamvoidbecomeNeutral(UUID otherTeam, boolean sendPostEvent) Used to become neutral to a teambooleanUsed to check if this team can damage members of the specified teambooleanUsed to check if this team can damage members of the specified teambooleancanDamage(org.bukkit.entity.Player player) Used to check if a member of this team can damage the specified playerbooleancanDamage(org.bukkit.entity.Player player, org.bukkit.entity.Player source) Used to check if a member of this team can damage the specified playerstatic booleanUsed to get the config value checking if ally chests can be openedvoidvoidvoidvoiddemotePlayer(TeamPlayer demotePlayer) This method is used to demote a player to the next applicable rank, this method does not check the demotion is valid but instead only promotes the player, see DemoteCommand to see validationstatic voiddisable()Used to disable betterteams so the singleton is removedvoiddisband()This command is used to disband a team, BE CAREFUL, this is irreversiblevoiddisband(org.bukkit.entity.Player player) This command is used to disband a team, BE CAREFUL, this is irreversible@NotNull String@NotNull StringgetAdventureDisplayName(boolean checkConfig) getAdventureTag(boolean checkConfig) the list of all UUIDS of teams that are allied with this teamgetAllyChatSyntax(TeamPlayer sender) tracks and provides utility methods relating to anchored players of this teamThis is used to store all players which are banned from the teamintstatic org.bukkit.LocationgetClaimingLocation(org.bukkit.block.Block block) static TeamgetClaimingTeam(org.bukkit.block.Block block) static TeamgetClaimingTeam(org.bukkit.Location location) @NotNull Stringorg.bukkit.ChatColorgetColor()The color of the teamThe description of a team, used in /team info@NotNull String@NotNull StringgetDisplayName(boolean asAdventure) @NotNull StringgetDisplayName(org.bukkit.ChatColor resetTo) @NotNull StringgetDisplayName(org.bukkit.ChatColor resetTo, boolean asAdventure) Used to get the current name of the teamorg.bukkit.inventory.InventorygetID()This is a list of invited players to this team since the last restart of the serverintgetLevel()intintdoubleintinttracks and provides utility methods relating to the members of this teamgetMeta()doublegetMoney()getName()The name of the team, this can be changed after the creation of a teams, so do not store references to itList<org.bukkit.entity.Player> Used to get a list of all the online players that are on this team@NotNull StringgetRank(PlayerRank rank) Used to get all players which have the specified rank within the teamintgetScore()org.bukkit.scoreboard.TeamgetScoreboardTeam(org.bukkit.scoreboard.Scoreboard board) Used throughout all below name management (showing team name above player name)org.bukkit.scoreboard.TeamUsed to return the scoreboard team, and not create a new one if it does not existgetTag()getTag(boolean asAdventure) getTag(org.bukkit.ChatColor returnTo) getTag(org.bukkit.ChatColor returnTo, boolean asAdventure) static @Nullable Teamstatic @Nullable Teamstatic @Nullable TeamgetTeam(@Nullable org.bukkit.OfflinePlayer player) intstatic TeamgetTeamByName(String name) getTeamChatSyntax(TeamPlayer sender) Used to get the chat syntax and apply placeholders when possibleorg.bukkit.LocationThe location of the teams home (/team home)intstatic TeamManager@Nullable TeamPlayergetTeamPlayer(org.bukkit.OfflinePlayer player) Used to get the teamPlayer version of an included playerintUsed to get a warp with the specified namegetWarps()booleanbooleanhasRequested(@Nullable Team team) Used to check if a team has sent an ally request for this teambooleanhasRequested(UUID team) Used to check if a team has sent an ally request for this teamvoidUsed to create an invite for the included player to this teambooleanUsed to check if a team is in alliance with this teambooleanUsed to check if a team is in alliance with this teambooleanbooleanisBanned(org.bukkit.OfflinePlayer player) This method searches the ban list to check if the player is bannedbooleanisClaimed(org.bukkit.Location location) booleanUsed to check if a player is invited to this teambooleanbooleanbooleanbooleanUsed to check if the provided team is a neutral to the other teambooleanisOpen()If the team is open or invite onlybooleanUsed to check if the given team player is anchored within this teambooleanisPlayerAnchored(org.bukkit.OfflinePlayer p) booleanisPvp()Tracks if the team has pvp enabled between team membersbooleanstatic booleanisValidTeamName(@Nullable String name) Used to check if the provided team name is a valid name for a teambooleanjoin(org.bukkit.entity.Player p) This is used when a player is joining the teamvoidpromotePlayer(TeamPlayer promotePlayer) This method is used to promote a player to the next applicable rank, this method does not check the promotion is valid but instead only promotes the player, see PromoteCommand to see validationvoidpromotePlayerToOwner(TeamPlayer promotePlayer) voidremoveAllyRequest(@Nullable Team team) Used to remove an ally request from this teamvoidremoveAllyRequest(UUID team) Used to remove an ally request from this teamvoidremoveAndSaveMeta(String key) voidremoveClaim(org.bukkit.Location location) Used to remove a chest claim from this teambooleanUsed to remove the given teamPlayer from the team, you must firstly be sure that the player is in this team (as it is not checked or caught in this method)booleanremovePlayer(org.bukkit.OfflinePlayer p) Used to remove the given player from the team, you must firstly be sure that the player is in this team (as it is not checked or caught in this method)voidvoidUsed to save all warps that this team has setvoidsendAllyMessage(TeamPlayer sender, String message) Used to send a message to all of the teams alliesvoidsendMessage(TeamPlayer sender, String message) Used when a player sends a message to the team chatbooleansetAnchored(boolean anchor) voidsetAndSaveMeta(String key, String value) voidsetColor(org.bukkit.ChatColor color) Used to change the team colorvoidsetDescription(String description) Used to change the team descriptionvoidsetLevel(int level) voidsetMoney(double money) voidThis is used to set the name of the team, it is important that you check that the name is unique before running this methodvoidsetOpen(boolean open) setPlayerAnchor(TeamPlayer p, boolean anchor) setPlayerAnchor(org.bukkit.OfflinePlayer p, boolean anchor) voidsetPvp(boolean pvp) voidsetScore(int score) voidvoidsetTeamBalRank(int rank) voidsetTeamHome(org.bukkit.Location teamHome) voidsetTeamRank(int rank) voidsetTitle(TeamPlayer player, String title) static voidsetupTeamManager(StorageType storageType) booleanToggle anchor status for this teamUsed for unanchoring this player.voidunbanPlayer(org.bukkit.OfflinePlayer player) This method is used to remove a player from the list of players which are banned from the team
-
Constructor Details
-
Team
this is used to load a team from the configuration file- Parameters:
id- the ID of the team to load
-
Team
Creates a new team with the provided nameThis is a private method as the creation of a new team should be done by the Team.createNewTeam(name) method
- Parameters:
name- The selected name for the teamid- The UUID of the teamowner- The owner of the team (whoever initiated the creation of the team)
-
-
Method Details
-
setupTeamManager
-
disable
public static void disable()Used to disable betterteams so the singleton is removed -
getTeamManager
-
getTeam
-
getTeam
-
getTeam
@Contract(pure=true, value="null -> null") @Nullable public static @Nullable Team getTeam(@Nullable @Nullable org.bukkit.OfflinePlayer player) -
getTeamByName
-
getClaimingTeam
-
getClaimingTeam
- Parameters:
location- the location of the chest - must already be normalised- Returns:
- The team which has claimed that chest the provided chest, will return null if that location is not claimed
-
getClaimingLocation
public static org.bukkit.Location getClaimingLocation(org.bukkit.block.Block block) -
canOpenAllyChests
public static boolean canOpenAllyChests()Used to get the config value checking if ally chests can be opened- Returns:
- If ally chests can be opened
-
isValidTeamName
Used to check if the provided team name is a valid name for a team- Parameters:
name- The name of the team- Returns:
- If the team name is valid
-
setName
This is used to set the name of the team, it is important that you check that the name is unique before running this method- Parameters:
name- the new team namexg
-
getOpenColor
-
getCloseColor
-
getAdventureDisplayName
-
getAdventureDisplayName
-
getDisplayName
-
getDisplayName
Used to get the current name of the team- Parameters:
resetTo- the color to return to at the end of the string- Returns:
- the name of the team
-
getDisplayName
-
getDisplayName
-
getAdventureTag
-
getAdventureTag
-
getTag
-
getTag
-
getTag
-
getTag
-
getOriginalTag
-
setTag
-
setOpen
public void setOpen(boolean open) -
setDescription
Used to change the team description- Parameters:
description- the new team description
-
setColor
public void setColor(org.bukkit.ChatColor color) Used to change the team color- Parameters:
color- the new team color
-
removePlayer
public boolean removePlayer(org.bukkit.OfflinePlayer p) Used to remove the given player from the team, you must firstly be sure that the player is in this team (as it is not checked or caught in this method)- Parameters:
p- the player to remove from the team- Returns:
- If the player was removed from the team
-
removePlayer
Used to remove the given teamPlayer from the team, you must firstly be sure that the player is in this team (as it is not checked or caught in this method)- Parameters:
p- the player to remove from the team- Returns:
- If the player was removed from the team
-
isPlayerAnchored
public boolean isPlayerAnchored(org.bukkit.OfflinePlayer p) -
isPlayerAnchored
Used to check if the given team player is anchored within this team- Parameters:
p- the team player
-
setPlayerAnchor
public AnchoredPlayerUUIDSetComponent.AnchorResult setPlayerAnchor(org.bukkit.OfflinePlayer p, boolean anchor) -
setPlayerAnchor
-
anchorPlayer
Used for anchoring this player.- Parameters:
p- the team player to anchor- Returns:
- AnchorResult
-
unanchorPlayer
Used for unanchoring this player.- Parameters:
p- the team player to unanchor- Returns:
- AnchorResult
-
getTeamPlayer
Used to get the teamPlayer version of an included player- Parameters:
player- the player to search for- Returns:
- the team player object for that player [null - player is not in the team]
-
getRank
Used to get all players which have the specified rank within the team- Parameters:
rank- the rank to search for- Returns:
- a list of players which have that rank [emtpy list - no players have that rank]
-
disband
public void disband()This command is used to disband a team, BE CAREFUL, this is irreversible -
disband
public void disband(org.bukkit.entity.Player player) This command is used to disband a team, BE CAREFUL, this is irreversible- Parameters:
player- The player responsible for disbandment [null - initiated by console]
-
isInvited
Used to check if a player is invited to this team- Parameters:
uuid- the UUID of the player to check- Returns:
- [true - the player is invited] [false - the player is not invited]
-
invite
Used to create an invite for the included player to this team- Parameters:
uniqueId- the UUID of the player being invited
-
join
public boolean join(org.bukkit.entity.Player p) This is used when a player is joining the team- Parameters:
p- the player who is joining the team- Returns:
- true if the player joined the team, else false
-
promotePlayer
This method is used to promote a player to the next applicable rank, this method does not check the promotion is valid but instead only promotes the player, see PromoteCommand to see validation- Parameters:
promotePlayer- the player to be promoted
-
promotePlayerToOwner
-
demotePlayer
This method is used to demote a player to the next applicable rank, this method does not check the demotion is valid but instead only promotes the player, see DemoteCommand to see validation- Parameters:
demotePlayer- the player to be demoted
-
setTeamHome
public void setTeamHome(org.bukkit.Location teamHome) -
deleteTeamHome
public void deleteTeamHome() -
banPlayer
public void banPlayer(org.bukkit.OfflinePlayer player) This method is used to add a player to the list of players which are banned from the team- Parameters:
player- the player to add to the list
-
unbanPlayer
public void unbanPlayer(org.bukkit.OfflinePlayer player) This method is used to remove a player from the list of players which are banned from the team- Parameters:
player- the player to remove from the list
-
isBanned
public boolean isBanned(org.bukkit.OfflinePlayer player) This method searches the ban list to check if the player is banned- Parameters:
player- the player to check- Returns:
- [true - the player is banned] [false - the player isen't banned]
-
sendMessage
Used when a player sends a message to the team chat- Parameters:
sender- the player which sent the message to the team chatmessage- the message to send to the team chat
-
getTeamChatSyntax
Used to get the chat syntax and apply placeholders when possible- Parameters:
sender- - The team player who sent the command
-
getAllyChatSyntax
-
sendAllyMessage
Used to send a message to all of the teams allies- Parameters:
sender- the player who sent the messagemessage- the message that the player sent
-
getScore
public int getScore() -
getScoreComponent
-
setScore
public void setScore(int score) -
getMoney
public double getMoney() -
getMoneyComponent
-
setMoney
public void setMoney(double money) -
getTeamRank
public int getTeamRank()- Returns:
- the rank of the team (-1 if the team has not been ranked)
-
setTeamRank
public void setTeamRank(int rank) -
setTeamBalRank
public void setTeamBalRank(int rank) -
getTeamBalRank
public int getTeamBalRank() -
getScoreboardTeam
public org.bukkit.scoreboard.Team getScoreboardTeam(org.bukkit.scoreboard.Scoreboard board) Used throughout all below name management (showing team name above player name)- Parameters:
board- the scoreboard to add the team to- Returns:
- the team that has been created
-
getScoreboardTeamOrNull
public org.bukkit.scoreboard.Team getScoreboardTeamOrNull()Used to return the scoreboard team, and not create a new one if it does not exist- Returns:
- The scoreboard team (if already created)
-
getBalance
-
setTitle
-
addAlly
Used to add an ally for this team- Parameters:
otherTeam- the UUID of the new allysendPostEvent- If you want the post event to be sent. This is useful if you are switching from one relation to another.
-
addAlly
Used to add an ally for this team- Parameters:
ally- the UUID of the new allysendPostEvent- If you want the post event to be sent. This is useful if you are switching from one relation to another.
-
addAlly
-
addAlly
-
becomeNeutral
Used to become neutral to a team- Parameters:
otherTeam- the team to become neutral tosendPostEvent- If you want the post event to be sent. This is useful if you are switching from one relation to another.
-
becomeNeutral
Used to become neutral to a team- Parameters:
otherTeam- the team to become neutral tosendPostEvent- If you want the post event to be sent. This is useful if you are switching from one relation to another.
-
isAlly
Used to check if a team is in alliance with this team- Parameters:
team- the team to check for allies- Returns:
- if the team is an ally
-
isAlly
Used to check if a team is in alliance with this team- Parameters:
team- the team to check for allies- Returns:
- if the team is an ally
-
isNeutral
Used to check if the provided team is a neutral to the other team- Parameters:
team- the team to check- Returns:
- if the team is neutral
-
isNeutral
-
addAllyRequest
Used to add an ally request to this team- Parameters:
team- the team that has sent the request
-
addAllyRequest
Used to add an ally request to this team- Parameters:
team- the team that has sent the request
-
removeAllyRequest
Used to remove an ally request from this team- Parameters:
team- the team to remove the ally request for
-
removeAllyRequest
Used to remove an ally request from this team- Parameters:
team- the team to remove the ally request for
-
hasRequested
Used to check if a team has sent an ally request for this team- Parameters:
team- the team to check for- Returns:
- if they have sent an ally request
-
hasRequested
Used to check if a team has sent an ally request for this team- Parameters:
team- the team to check for- Returns:
- if they have sent an ally request
-
getAllyRequests
- Returns:
- the set of all UUIDS of teams that have sent ally requests
-
getID
-
canDamage
public boolean canDamage(org.bukkit.entity.Player player, org.bukkit.entity.Player source) Used to check if a member of this team can damage the specified player- Parameters:
player- the player to check forsource- the source of the damage- Returns:
- if this team can damage that player
-
canDamage
Used to check if this team can damage members of the specified team- Parameters:
team- the team to testsource- The source of the damage- Returns:
- if players of this team can damage members of the other team
-
canDamage
public boolean canDamage(org.bukkit.entity.Player player) Used to check if a member of this team can damage the specified player- Parameters:
player- the player to check for- Returns:
- if this team can damage that player
-
canDamage
Used to check if this team can damage members of the specified team- Parameters:
team- the team to test- Returns:
- if players of this team can damage members of the other team
-
hasMaxAllies
public boolean hasMaxAllies() -
saveWarps
public void saveWarps()Used to save all warps that this team has set -
getWarp
Used to get a warp with the specified name- Parameters:
name- the name of the warp- Returns:
- the warp with that name
-
addWarp
-
delWarp
-
getOnlineMembers
Used to get a list of all the online players that are on this team- Returns:
- a list of online members for this team
-
addClaim
public void addClaim(org.bukkit.Location location) Used to add a chest claim to this team- Parameters:
location- The location of the chest claim (round to the nearest block)
-
removeClaim
public void removeClaim(org.bukkit.Location location) Used to remove a chest claim from this team- Parameters:
location- The location of the chest claim (round to the nearest block)
-
clearClaims
public void clearClaims() -
getClaimCount
public int getClaimCount() -
isClaimed
public boolean isClaimed(org.bukkit.Location location) -
saveEchest
public void saveEchest() -
getEchest
public org.bukkit.inventory.Inventory getEchest() -
getEchestComponent
-
getMaxWarps
public int getMaxWarps() -
getMaxChests
public int getMaxChests() -
setLevel
public void setLevel(int level) -
setPvp
public void setPvp(boolean pvp) -
toggleAnchor
public boolean toggleAnchor()Toggle anchor status for this team- Returns:
- false if trying to anchor the team and its home is not set, true otherwise
-
setAnchored
public boolean setAnchored(boolean anchor) -
isAnchored
public boolean isAnchored() -
getMaxMoney
public double getMaxMoney() -
getTeamLimit
public int getTeamLimit() -
isTeamFull
public boolean isTeamFull() -
getMaxAdmins
public int getMaxAdmins() -
getMaxOwners
public int getMaxOwners() -
isMaxAdmins
public boolean isMaxAdmins() -
isMaxOwners
public boolean isMaxOwners() -
setAndSaveMeta
-
removeAndSaveMeta
-
getLevelObject
-
getStorage
-
getName
The name of the team, this can be changed after the creation of a teams, so do not store references to it -
getDescription
The description of a team, used in /team info -
isOpen
public boolean isOpen()If the team is open or invite onlychange this to an enum - which is more expressive
- Returns:
- [true - anyone can join the team] [false - the team is invite only]
-
getTeamHome
public org.bukkit.Location getTeamHome()The location of the teams home (/team home) -
getMembers
tracks and provides utility methods relating to the members of this team -
getAnchoredPlayers
tracks and provides utility methods relating to anchored players of this team -
getAllies
the list of all UUIDS of teams that are allied with this team -
getInvitedPlayers
This is a list of invited players to this team since the last restart of the server -
getBannedPlayers
This is used to store all players which are banned from the team -
isPvp
public boolean isPvp()Tracks if the team has pvp enabled between team members -
getColor
public org.bukkit.ChatColor getColor()The color of the team -
getLevel
public int getLevel() -
getWarps
-
getMeta
-