Class StorageVehicle
java.lang.Object
nl.sbdeveloper.vehiclesplus.api.vehicles.Vehicle
nl.sbdeveloper.vehiclesplus.api.vehicles.impl.StorageVehicle
- All Implemented Interfaces:
IVehicle
,QueuedSavable
,Savable
A vehicle that is stored in a garage.
-
Constructor Summary
ConstructorsConstructorDescriptionStorageVehicle
(@NotNull UUID uuid, @NotNull VehicleModel model, boolean persistent) Construct a StorageVehicle, that is loaded from storage. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
void
The message to show in the player's actionbar@NotNull String
The display name of this StorageVehicle, used in chat and inventories@NotNull String
Get the display name.<T extends MovementStrategy,
R>
RgetFromStrategy
(MovementType type, Function<T, R> applyFunction, R defaultValue) Get the information of this vehicle<V> V
Get the first occurrence of a specific type.@Nullable Part
getPart
(org.bukkit.entity.ArmorStand stand) Get a part from the holder stand.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<V> @NotNull List
<V> Get all the parts of a specific type.@Nullable org.bukkit.Location
The location where this vehicle is placedThe statics of this vehicleList
<org.bukkit.inventory.ItemStack> The items the trunk contains Does NOT include AIRgetUuid()
The unique identifier of this vehicleGet the basevehicle / type of this vehicleboolean
Check if this vehicle has any addon parts.int
hashCode()
boolean
If this vehicle is persistent (instance of PersistentVehicle)void
setActionBarMessage
(String actionBarMessage) The message to show in the player's actionbarvoid
setDisplayName
(@NotNull String displayName) The display name of this StorageVehicle, used in chat and inventoriesvoid
setPersistentLocation
(@Nullable org.bukkit.Location persistentLocation) The location where this vehicle is placedspawn
(@NonNull org.bukkit.Location loc, boolean force) Spawn this vehicle.spawn
(@NonNull org.bukkit.entity.Player spawner, boolean force) Spawn this vehicle as a drivable vehicle.spawnPersistent
(org.bukkit.Location loc) Spawn this vehicle as a persistent vehicle.toString()
Methods inherited from class nl.sbdeveloper.vehiclesplus.api.vehicles.Vehicle
getGarage, getSpawnedVehicle, getStorageVehicle, getStorageVehicle, isSpawned, remove, remove
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface nl.sbdeveloper.vehiclesplus.storage.db.QueuedSavable
save
-
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
Get the display name. This also includesChatColor
.- Returns:
- The display name.
-
forceSave
- Specified by:
forceSave
in interfaceQueuedSavable
- Throws:
DataStorageException
-
getSaveIdentifier
- Specified by:
getSaveIdentifier
in interfaceQueuedSavable
-
getSaveError
- Specified by:
getSaveError
in interfaceQueuedSavable
-
spawnPersistent
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
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
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
Description copied from class:Vehicle
Get the basevehicle / type of this vehicle- Specified by:
getVehicleModel
in classVehicle
- Returns:
- The basevehicle / type of this vehicle
- Throws:
IllegalArgumentException
-
getPart
Description copied from class:Vehicle
Get the first occurrence of a specific type. -
getParts
Description copied from class:Vehicle
Get all the parts of a specific type. -
getPart
Description copied from class:Vehicle
Get a part from the holder stand. -
hasAddedParts
public boolean hasAddedParts()Description copied from class:Vehicle
Check if this vehicle has any addon parts.- Specified by:
hasAddedParts
in classVehicle
- Returns:
- If this vehicle has any addon parts.
-
getInfoList
Description copied from class:Vehicle
Get the information of this vehicle- Specified by:
getInfoList
in classVehicle
- 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 interfaceIVehicle
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-
getUuid
The unique identifier of this vehicle -
getDisplayName
The display name of this StorageVehicle, used in chat and inventories -
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 -
getTrunkItems
The items the trunk contains Does NOT include AIR -
getStatics
The statics of this vehicle- Specified by:
getStatics
in classVehicle
- Returns:
- The statics of this vehicle
-
getActionBarMessage
The message to show in the player's actionbar -
setDisplayName
The display name of this StorageVehicle, used in chat and inventories -
setActionBarMessage
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
-