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 booleanbooleanvoidThe message to show in the player's actionbar@NotNull StringThe display name of this StorageVehicle, used in chat and inventories@NotNull StringGet the display name.<T extends MovementStrategy,R>
RgetFromStrategy(MovementType type, Function<T, R> applyFunction, R defaultValue) Get the information of this vehicle<V> VGet the first occurrence of a specific type.@Nullable PartgetPart(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.LocationThe 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 vehiclebooleanCheck if this vehicle has any addon parts.inthashCode()booleanIf this vehicle is persistent (instance of PersistentVehicle)voidsetActionBarMessage(String actionBarMessage) The message to show in the player's actionbarvoidsetDisplayName(@NotNull String displayName) The display name of this StorageVehicle, used in chat and inventoriesvoidsetPersistentLocation(@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, removeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
forceSavein interfaceQueuedSavable- Throws:
DataStorageException
-
getSaveIdentifier
- Specified by:
getSaveIdentifierin interfaceQueuedSavable
-
getSaveError
- Specified by:
getSaveErrorin 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:VehicleGet the basevehicle / type of this vehicle- Specified by:
getVehicleModelin classVehicle- Returns:
- The basevehicle / type of this vehicle
- Throws:
IllegalArgumentException
-
getPart
Description copied from class:VehicleGet the first occurrence of a specific type. -
getParts
Description copied from class:VehicleGet all the parts of a specific type. -
getPart
Description copied from class:VehicleGet a part from the holder stand. -
hasAddedParts
public boolean hasAddedParts()Description copied from class:VehicleCheck if this vehicle has any addon parts.- Specified by:
hasAddedPartsin classVehicle- Returns:
- If this vehicle has any addon parts.
-
getInfoList
Description copied from class:VehicleGet the information of this vehicle- Specified by:
getInfoListin 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:
getFromStrategyin 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:
getStaticsin 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
-