Class StorageVehicle

java.lang.Object
nl.sbdeveloper.vehiclesplus.api.vehicles.Vehicle
nl.sbdeveloper.vehiclesplus.api.vehicles.impl.StorageVehicle
All Implemented Interfaces:
IVehicle, QueuedSavable, Savable

public class StorageVehicle extends Vehicle implements QueuedSavable
A vehicle that is stored in a garage.
  • Constructor Details

    • StorageVehicle

      @Internal public StorageVehicle(@NotNull @NotNull UUID uuid, @NotNull @NotNull VehicleModel model, boolean persistent)
      Construct a StorageVehicle, that is loaded from storage. This constructor is INTERNAL, and should not be used to construct a new vehicle.
      Parameters:
      uuid - The UUID of the StorageVehicle.
      model - The vehicle model.
  • Method Details

    • getDisplayNameColored

      @NotNull public @NotNull String getDisplayNameColored()
      Get the display name. This also includes ChatColor.
      Returns:
      The display name.
    • 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
    • spawnPersistent

      public PersistentVehicle spawnPersistent(org.bukkit.Location loc)
      Spawn this vehicle as a persistent vehicle. This vehicle will not despawn when the player leaves the server.
      Parameters:
      loc - The location to spawn it at.
      Returns:
      The PersistentVehicle if spawned,
    • spawn

      public DrivableVehicle spawn(@NonNull @NonNull org.bukkit.entity.Player spawner, boolean force)
      Spawn this vehicle as a drivable vehicle. This vehicle can be driven by a player.
      Parameters:
      spawner - The player who spawns the vehicle. It's location will be the spawn point.
      force - Should the spawn be forced? If so, the event can't cancel the spawn.
      Returns:
      The SpawnedVehicle if spawned, or null if failed because the event has been cancelled.
    • spawn

      public DrivableVehicle spawn(@NonNull @NonNull org.bukkit.Location loc, boolean force)
      Spawn this vehicle.
      Parameters:
      loc - The location to spawn it at.
      force - Should the spawn be forced? If so, the event can't cancel the spawn.
      Returns:
      The SpawnedVehicle if spawned, or null if failed because the event has been cancelled.
    • getVehicleModel

      public VehicleModel getVehicleModel() throws IllegalArgumentException
      Description copied from class: Vehicle
      Get the basevehicle / type of this vehicle
      Specified by:
      getVehicleModel in class Vehicle
      Returns:
      The basevehicle / type of this vehicle
      Throws:
      IllegalArgumentException
    • getPart

      public <V> V getPart(@NotNull @NotNull Class<V> partClass)
      Description copied from class: Vehicle
      Get the first occurrence of a specific type.
      Specified by:
      getPart in class Vehicle
      Type Parameters:
      V - The part itself.
      Parameters:
      partClass - The class of the part.
      Returns:
      The part of that type, or null if not found.
    • getParts

      @NotNull public <V> @NotNull List<V> getParts(@NotNull @NotNull Class<V> partClass)
      Description copied from class: Vehicle
      Get all the parts of a specific type.
      Specified by:
      getParts in class Vehicle
      Type Parameters:
      V - The part itself.
      Parameters:
      partClass - The class of the part.
      Returns:
      A list of all the parts of that type.
    • getPart

      @Nullable public @Nullable Part getPart(org.bukkit.entity.ArmorStand stand)
      Description copied from class: Vehicle
      Get a part from the holder stand.
      Specified by:
      getPart in class Vehicle
      Parameters:
      stand - The holder stand.
      Returns:
      The part.
    • hasAddedParts

      public boolean hasAddedParts()
      Description copied from class: Vehicle
      Check if this vehicle has any addon parts.
      Specified by:
      hasAddedParts in class Vehicle
      Returns:
      If this vehicle has any addon parts.
    • getInfoList

      public List<String> getInfoList()
      Description copied from class: Vehicle
      Get the information of this vehicle
      Specified by:
      getInfoList in class Vehicle
      Returns:
      A list with the formatted information
    • getFromStrategy

      public <T extends MovementStrategy, R> R getFromStrategy(MovementType type, Function<T,R> applyFunction, @NotNull R defaultValue)
      Specified by:
      getFromStrategy in interface IVehicle
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getUuid

      public UUID getUuid()
      The unique identifier of this vehicle
      Specified by:
      getUuid in class Vehicle
      Returns:
      The UUID of this vehicle
    • getDisplayName

      @NotNull public @NotNull String getDisplayName()
      The display name of this StorageVehicle, used in chat and inventories
    • getParts

      @NotNull public @NotNull List<Part> getParts()
      The list of parts that this vehicle has MOST of the time, this is the same as in the VehicleModel, but with changes For example, if the color of the skin is changed, the Skin part is different Or, for example if this vehicle has custom parts added to it
      Specified by:
      getParts in class Vehicle
      Returns:
      A list of all the parts.
    • getTrunkItems

      public List<org.bukkit.inventory.ItemStack> getTrunkItems()
      The items the trunk contains Does NOT include AIR
    • getStatics

      public VehicleStatics getStatics()
      The statics of this vehicle
      Specified by:
      getStatics in class Vehicle
      Returns:
      The statics of this vehicle
    • getActionBarMessage

      public String getActionBarMessage()
      The message to show in the player's actionbar
    • setDisplayName

      public void setDisplayName(@NotNull @NotNull String displayName)
      The display name of this StorageVehicle, used in chat and inventories
    • setActionBarMessage

      public void setActionBarMessage(String actionBarMessage)
      The message to show in the player's actionbar
    • isPersistent

      public boolean isPersistent()
      If this vehicle is persistent (instance of PersistentVehicle)
    • getPersistentLocation

      @Nullable public @Nullable org.bukkit.Location getPersistentLocation()
      The location where this vehicle is placed
    • setPersistentLocation

      public void setPersistentLocation(@Nullable @Nullable org.bukkit.Location persistentLocation)
      The location where this vehicle is placed