java.lang.Object
nl.sbdeveloper.vehiclesplus.api.garages.Garage
All Implemented Interfaces:
QueuedSavable, Savable

public class Garage extends Object implements QueuedSavable
  • Constructor Details

    • Garage

      public Garage(@NotNull @NotNull String name, @NotNull @NotNull UUID ownerUUID)
      Construct a new Garage.
      Parameters:
      name - The name and unique identifier of the garage.
      ownerUUID - The UUID of the owner.
    • Garage

      public Garage(@NotNull @NotNull String name, @NotNull @NotNull UUID ownerUUID, String displayName)
      Represents a Garage.
    • Garage

      public Garage(@NotNull @NotNull String name, @NotNull @NotNull UUID ownerUUID, String displayName, boolean personal)
      Constructs a new Garage instance with the provided parameters.
      Parameters:
      name - The name and unique identifier of the garage. (NonNull)
      ownerUUID - The UUID of the owner. (NonNull)
      displayName - The display name of the garage menu. (Nullable)
      personal - Indicates if the garage is personal or not.
  • Method Details

    • forceSave

      public void forceSave() throws DataStorageException
      Specified by:
      forceSave in interface QueuedSavable
      Throws:
      DataStorageException
    • getSaveIdentifier

      public String getSaveIdentifier()
      Specified by:
      getSaveIdentifier in interface QueuedSavable
    • getSaveError

      public String getSaveError()
      Specified by:
      getSaveError in interface QueuedSavable
    • addRole

      public GarageRole addRole(String roleName)
      Adds a new role to the garage.
      Parameters:
      roleName - The name of the role to add. (NonNull)
      Returns:
      The GarageRoles object representing the added role.
    • removeRole

      public boolean removeRole(String roleName)
      Removes a role from the garage.
      Parameters:
      roleName - The name of the role to remove. (NonNull)
      Returns:
      true if the role was successfully removed, false otherwise.
    • removeRole

      public boolean removeRole(String roleName, boolean force)
      Removes a role from the garage.
      Parameters:
      roleName - The name of the role to remove. (NonNull)
      force - Indicates whether to remove the role even if it is assigned to a member.
      Returns:
      true if the role was successfully removed, false otherwise.
    • getRole

      public GarageRole getRole(org.bukkit.entity.Player player)
      Get the role of a player in this garage.
      Parameters:
      player - The player to get the role of.
      Returns:
      The role of the player in this garage.
    • getRole

      public Optional<GarageRole> getRole(String roleName)
      Returns the GarageRole object associated with the specified role name. If the role does not exist, null is returned.
      Parameters:
      roleName - The name of the role to retrieve. (NonNull)
      Returns:
      The GarageRole object associated with the specified role name, or null if the role does not exist.
    • getRole

      public Optional<GarageRole> getRole(String roleName, boolean force)
      Returns the GarageRole object associated with the specified role name. If the role does not exist, null is returned.
      Parameters:
      roleName - The name of the role to retrieve. (NonNull)
      force - Indicates whether to add the role if it does not exist.
      Returns:
      The GarageRole object associated with the specified role name, or null if the role does not exist.
    • addMember

      public void addMember(UUID member)
      Adds a member to this garage.
      Parameters:
      member - The UUID of the member to add. (NonNull)
    • addMember

      public void addMember(UUID member, String roleName)
      Adds a member to this garage with a specified role name.
      Parameters:
      member - The UUID of the member to add. (NonNull)
      roleName - The name of the role to assign to the member. (NonNull)
    • removeMember

      public boolean removeMember(UUID member)
      Removes a member from the garage.
      Parameters:
      member - The UUID of the member to remove.
      Returns:
      true if the member was successfully removed, false otherwise.
    • getMember

      public GarageMember getMember(UUID playerUUID)
      Get the member object of a player in this garage.
      Parameters:
      playerUUID - The UUID of the player to get the member object of.
      Returns:
      The member object of the player in this garage.
    • getMember

      public GarageMember getMember(org.bukkit.entity.Player player)
      Get the member object of a player in this garage.
      Parameters:
      player - The player to get the member object of.
      Returns:
      The member object of the player in this garage.
    • addVehicle

      public void addVehicle(UUID vehicle)
      Add a vehicle to this garage.
    • removeVehicle

      public boolean removeVehicle(UUID vehicle)
      Remove a vehicle from this garage.
    • getOwner

      public org.bukkit.OfflinePlayer getOwner()
      Get the owner of this garage.
      Returns:
      The owner of this garage.
    • setOwner

      public void setOwner(org.bukkit.entity.Player owner)
      Set the owner of this garage.
      Parameters:
      owner - The new owner of this garage.
    • getName

      @NotNull public @NotNull String getName()
      The name and unique identifier of this garage (used for the command /garage (name))
    • isPersonal

      public boolean isPersonal()
      Represents whether this garage is a personal garage or broader
    • getMembers

      public List<GarageMember> getMembers()
      The members of this garage
    • getRoles

      public List<GarageRole> getRoles()
      The roles of this garage
    • getDisplayName

      public String getDisplayName()
      The display name of the garage menu Might contain ChatColor (as ampersand string)!
    • getVehicles

      public List<UUID> getVehicles()
      The list of vehicles in this garage
    • setPersonal

      public void setPersonal(boolean personal)
      Represents whether this garage is a personal garage or broader
    • setName

      public void setName(@NotNull @NotNull String name)
      Change the name of this garage.
    • setDisplayName

      public void setDisplayName(String displayName)
      Change the display name of this garage.