Package net.lewmc.essence.utils
Class TeamUtil
java.lang.Object
net.lewmc.essence.utils.TeamUtil
Team Utility
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptRequest
(String team, String player) Accepts a pending join request.boolean
areTeammates
(org.bukkit.entity.Player p1, org.bukkit.entity.Player p2) Checks if players are in the same team..boolean
changeLeader
(String playerTeam, String newLeader, String oldLeader) Changes a team's leader.void
CreateNewTeam
(String name, UUID leader) Creates a new teamboolean
declineRequest
(String team, String player) Declines a pending join request.boolean
Disbands a team.boolean
Checks if a team exists.getPlayerTeam
(UUID player) Get the requested player's team.boolean
Gets a rule for a team.getTeamLeader
(String team) Gets a team's leader,getTeamMembers
(String team) Gets a string list of the team's members.boolean
hasRequested
(String team, String username) Checks if a user has requested to join a team.boolean
Checks if user is the leader of the team.boolean
Checks if the player is a member of a team.boolean
Kicks a player from a team.boolean
Leaves a team.void
requestJoin
(String team, UUID player) Adds a join request to a specific team.requestsToJoin
(String team) Lists pending join requests.boolean
Sets a rule for a team.
-
Constructor Details
-
TeamUtil
Constructor for TeamUtil.- Parameters:
plugin
- Reference to main Essence class.message
- MessageUtil - reference to MessageUtil class.
-
-
Method Details
-
CreateNewTeam
Creates a new team- Parameters:
name
- String - Team nameleader
- UUID - Leader's UUID
-
requestJoin
Adds a join request to a specific team.- Parameters:
team
- String - team nameplayer
- UUID - UUID of the player requesting to join.
-
requestsToJoin
Lists pending join requests.- Parameters:
team
- String - team name- Returns:
- String - list of join requests as a String
-
isLeader
Checks if user is the leader of the team.- Parameters:
team
- String - team nameplayer
- UUID - Player's UUID.- Returns:
- boolean - If they are the leader.
-
getPlayerTeam
Get the requested player's team.- Parameters:
player
- UUID - Player's UUID.- Returns:
- String - Name of the player's team.
-
acceptRequest
Accepts a pending join request.- Parameters:
team
- String - Team nameplayer
- String - Player's name.- Returns:
- boolean - If the operation was successful.
-
declineRequest
Declines a pending join request.- Parameters:
team
- String - Team nameplayer
- String - Player's name.- Returns:
- boolean - If the operation was successful.
-
leave
Leaves a team.- Parameters:
playerTeam
- String - The name of the team the player should leave.uuid
- UUID - The player who is leaving's UUID,- Returns:
- boolean - If the operation is successful.
-
changeLeader
Changes a team's leader.- Parameters:
playerTeam
- String - Name of the team.newLeader
- String - Name of the team's new leader.oldLeader
- String - Name of the team's old leader.- Returns:
- boolean - If the operation was successful.
-
getTeamLeader
Gets a team's leader,- Parameters:
team
- String - The team to request the leader of.- Returns:
- String - The leader of the team.
-
getTeamMembers
Gets a string list of the team's members.- Parameters:
team
- String - Name of the team.- Returns:
- String - List of team members as a string.
-
kick
Kicks a player from a team.- Parameters:
playerTeam
- String - Name of the team.playerToKick
- String - Name of the player to kick.- Returns:
- boolean - If the operation was successful.
-
isMember
Checks if the player is a member of a team.- Parameters:
team
- String - Name of the team.username
- String - Player's username.- Returns:
- boolean - If the player is a member.
-
hasRequested
Checks if a user has requested to join a team.- Parameters:
team
- String - Team name.username
- String - Player name.- Returns:
- boolean - If the player has requested to join a team.
-
disband
Disbands a team.- Parameters:
team
- String - Name of the team.teamLeader
- String - A team's leader.- Returns:
- boolean - If the operation was successful.
-
areTeammates
public boolean areTeammates(org.bukkit.entity.Player p1, org.bukkit.entity.Player p2) Checks if players are in the same team..- Parameters:
p1
- Player - Player 1.p2
- Player - Player 2.- Returns:
- boolean - If the players are in the same team.
-
getRule
Gets a rule for a team.- Parameters:
team
- String - Team name.rule
- String - Rule name- Returns:
- boolean - If the rule is set to true or false.
-
setRule
Sets a rule for a team.- Parameters:
team
- String - Team name.rule
- String - Rule to set.value
- boolean - Value of a rule.- Returns:
- boolean - if the operation was successful.
-
exists
Checks if a team exists.- Parameters:
team
- String - Team name- Returns:
- boolean - If the team exists.
-