Class TeamUtil

java.lang.Object
net.lewmc.essence.utils.TeamUtil

public class TeamUtil extends Object
Team Utility
  • Constructor Details

    • TeamUtil

      public TeamUtil(Essence plugin, MessageUtil message)
      Constructor for TeamUtil.
      Parameters:
      plugin - Reference to main Essence class.
      message - MessageUtil - reference to MessageUtil class.
  • Method Details

    • CreateNewTeam

      public void CreateNewTeam(String name, UUID leader)
      Creates a new team
      Parameters:
      name - String - Team name
      leader - UUID - Leader's UUID
    • requestJoin

      public void requestJoin(String team, UUID player)
      Adds a join request to a specific team.
      Parameters:
      team - String - team name
      player - UUID - UUID of the player requesting to join.
    • requestsToJoin

      public String requestsToJoin(String team)
      Lists pending join requests.
      Parameters:
      team - String - team name
      Returns:
      String - list of join requests as a String
    • isLeader

      public boolean isLeader(String team, UUID player)
      Checks if user is the leader of the team.
      Parameters:
      team - String - team name
      player - UUID - Player's UUID.
      Returns:
      boolean - If they are the leader.
    • getPlayerTeam

      @Nullable public @Nullable String getPlayerTeam(UUID player)
      Get the requested player's team.
      Parameters:
      player - UUID - Player's UUID.
      Returns:
      String - Name of the player's team.
    • acceptRequest

      public boolean acceptRequest(String team, String player)
      Accepts a pending join request.
      Parameters:
      team - String - Team name
      player - String - Player's name.
      Returns:
      boolean - If the operation was successful.
    • declineRequest

      public boolean declineRequest(String team, String player)
      Declines a pending join request.
      Parameters:
      team - String - Team name
      player - String - Player's name.
      Returns:
      boolean - If the operation was successful.
    • leave

      public boolean leave(String playerTeam, UUID uuid)
      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

      public boolean changeLeader(String playerTeam, String newLeader, String oldLeader)
      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

      public String getTeamLeader(String team)
      Gets a team's leader,
      Parameters:
      team - String - The team to request the leader of.
      Returns:
      String - The leader of the team.
    • getTeamMembers

      public String getTeamMembers(String team)
      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

      public boolean kick(String playerTeam, String playerToKick)
      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

      public boolean isMember(String team, String username)
      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

      public boolean hasRequested(String team, String username)
      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

      public boolean disband(String team, String teamLeader)
      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

      public boolean getRule(String team, String rule)
      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

      public boolean setRule(String team, String rule, boolean value)
      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

      public boolean exists(String team)
      Checks if a team exists.
      Parameters:
      team - String - Team name
      Returns:
      boolean - If the team exists.