Package nl.sbdeveloper.vehiclesplus.api
Class VehiclesPlusAPI
java.lang.Object
nl.sbdeveloper.vehiclesplus.api.VehiclesPlusAPI
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Adds a garage to the garage map.static StorageVehicle
createVehicle
(@NotNull String modelID) Create a vehicle using a vehicle model.static StorageVehicle
createVehicle
(@NotNull String modelID, @NotNull Function<StorageVehicle, StorageVehicle> updater) Create a vehicle using a vehicle model.static StorageVehicle
createVehicle
(@NotNull String modelID, @NotNull Garage garage) Create a vehicle using a vehicle model.static StorageVehicle
createVehicle
(@NotNull String modelID, @NotNull Garage garage, @NotNull Function<StorageVehicle, StorageVehicle> updater) Create a vehicle using a vehicle model.static @NotNull StorageVehicle
createVehicle
(@NotNull VehicleModel model) Create a vehicle using a vehicle model.static StorageVehicle
createVehicle
(@NotNull VehicleModel model, @NotNull Function<StorageVehicle, StorageVehicle> updater) Create a vehicle using a vehicle model.static @NotNull StorageVehicle
createVehicle
(@NotNull VehicleModel model, @NotNull Garage garage) Create a vehicle using a vehicle model.static StorageVehicle
createVehicle
(@NotNull VehicleModel model, Garage garage, Function<StorageVehicle, StorageVehicle> updater) Create a vehicle using a vehicle model.static boolean
doesPlayerOwnVehicles
(@NotNull org.bukkit.OfflinePlayer p) Check if a player owns any vehicles.getFuelType
(@NotNull String fuelType) Get a fuel type by its name.All the registered fuel typesGet a garage by name.Get a garage by a vehicle.All the garages.getGarages
(@NotNull org.bukkit.OfflinePlayer player) Get the garages the player owns or is member in.getGarages
(@NotNull org.bukkit.OfflinePlayer player, boolean ownerOnly) Get the garages the player owns or is member in.getHooks()
static @NotNull Garage
getPersonalGarage
(@NotNull org.bukkit.OfflinePlayer player) Get the personal garage of a player.getRimDesign
(@NotNull String rimDesignID) Get a rimdesign by its ID.All the registered rim designsstatic @NotNull List
<SpawnedVehicle> Get all theSpawnedVehicle
sstatic @NotNull List
<SpawnedVehicle> getSpawnedVehicles
(@NotNull org.bukkit.OfflinePlayer p) Get the spawned vehicles owned by this player.static @NotNull List
<StorageVehicle> Get all theStorageVehicle
sstatic @NotNull List
<StorageVehicle> getStorageVehicles
(@NotNull org.bukkit.OfflinePlayer p, boolean force) Get the vehicles owned by this player.static Vehicle
getVehicle
(UUID vehicleUUID) Get a vehicle by its UUID.static @NotNull Optional
<SpawnedVehicle> getVehicle
(@NotNull org.bukkit.entity.Player p) Get the vehicle a player is driving.static @NotNull Optional
<SpawnedVehicle> getVehicleFromHolder
(@NotNull org.bukkit.entity.ArmorStand stand) Get the vehicle by a holderArmorStand
.static @NotNull Optional
<SpawnedVehicle> getVehicleFromPart
(@NotNull org.bukkit.entity.ArmorStand stand) Get the vehicle by a partArmorStand
.static @NotNull Optional
<VehicleModel> getVehicleModel
(@NotNull String modelID) Get a vehicle model by its ID.static Map
<String, VehicleModel> All the registered vehicle modelsAll the vehicles, can be both stored or spawned.getVehicles
(@NotNull org.bukkit.OfflinePlayer p) Get the vehicles owned by this player.static @NotNull Optional
<VehicleType> getVehicleType
(@NotNull String typeID) Get a vehicletype by its ID.static Map
<String, VehicleType> All the registered vehicle typesstatic void
registerHook
(Runnable hook) Register a new API hook.static void
registerPart
(@NotNull Class<? extends Part> partClass) Register a new custom Partstatic boolean
removeGarage
(@NotNull String name) Remove aGarage
from a Player's garages.
-
Method Details
-
getFuelType
Get a fuel type by its name.- Parameters:
fuelType
- The fuel type to load.- Returns:
- The
FuelType
-
getRimDesign
@NotNull public static @NotNull Optional<RimDesign> getRimDesign(@NotNull @NotNull String rimDesignID) Get a rimdesign by its ID.- Parameters:
rimDesignID
- The ID of the rimdesign.- Returns:
- The
RimDesign
-
getVehicleType
@NotNull public static @NotNull Optional<VehicleType> getVehicleType(@NotNull @NotNull String typeID) Get a vehicletype by its ID.- Parameters:
typeID
- The ID of the vehicletype.- Returns:
- The
VehicleType
-
getVehicleModel
@NotNull public static @NotNull Optional<VehicleModel> getVehicleModel(@NotNull @NotNull String modelID) Get a vehicle model by its ID.- Parameters:
modelID
- The ID of the vehicle model.- Returns:
- The
VehicleModel
-
createVehicle
Create a vehicle using a vehicle model.- Parameters:
modelID
- The ID of the vehicle model.- Returns:
- The
Vehicle
created, or null if the model does not exist. The function also saves theStorageVehicle
.
-
createVehicle
@Nullable public static StorageVehicle createVehicle(@NotNull @NotNull String modelID, @NotNull @NotNull Garage garage) Create a vehicle using a vehicle model.- Parameters:
modelID
- The ID of the vehicle model.garage
- The garage to add the vehicle to.- Returns:
- The
Vehicle
created, or null if the model does not exist. The function also saves theStorageVehicle
and theGarage
it was added to.
-
createVehicle
@Nullable public static StorageVehicle createVehicle(@NotNull @NotNull String modelID, @NotNull @NotNull Function<StorageVehicle, StorageVehicle> updater) Create a vehicle using a vehicle model.- Parameters:
modelID
- The ID of the vehicle model.updater
- Function to update the StorageVehicle created before saving it.- Returns:
- The
StorageVehicle
created, with the updater function applied, or null if the model does not exist or the function returned null. The function also saves theStorageVehicle
.
-
createVehicle
@Nullable public static StorageVehicle createVehicle(@NotNull @NotNull String modelID, @NotNull @NotNull Garage garage, @NotNull @NotNull Function<StorageVehicle, StorageVehicle> updater) Create a vehicle using a vehicle model.- Parameters:
modelID
- The ID of the vehicle model.garage
- The garage to add the vehicle to.updater
- Function to update the StorageVehicle created before saving it.- Returns:
- The
StorageVehicle
created, with the updater function applied, or null if the model does not exist or the function returned null. The function also saves theStorageVehicle
and theGarage
it was added to.
-
createVehicle
Create a vehicle using a vehicle model.- Parameters:
model
- The vehicle model.- Returns:
- The
StorageVehicle
created. The function also saves theStorageVehicle
.
-
createVehicle
@NotNull public static @NotNull StorageVehicle createVehicle(@NotNull @NotNull VehicleModel model, @NotNull @NotNull Garage garage) Create a vehicle using a vehicle model.- Parameters:
model
- The vehicle model.garage
- The garage to add the vehicle to.- Returns:
- The
StorageVehicle
created. The function also saves theStorageVehicle
and theGarage
it was added to.
-
createVehicle
@Nullable public static StorageVehicle createVehicle(@NotNull @NotNull VehicleModel model, @NotNull @NotNull Function<StorageVehicle, StorageVehicle> updater) Create a vehicle using a vehicle model.- Parameters:
model
- The vehicle model.updater
- Function to update the StorageVehicle created before saving it.- Returns:
- The
StorageVehicle
created, with the updater function applied, or null if the function returned null. The function also saves theStorageVehicle
.
-
createVehicle
@Nullable public static StorageVehicle createVehicle(@NotNull @NotNull VehicleModel model, @Nullable Garage garage, @Nullable Function<StorageVehicle, StorageVehicle> updater) Create a vehicle using a vehicle model.- Parameters:
model
- The vehicle model.garage
- The garage to add the vehicle to.updater
- Function to update the StorageVehicle created before saving it.- Returns:
- The
StorageVehicle
created, with the updater function applied, or null if the function returned null. The function also saves theStorageVehicle
and theGarage
it was added to.
-
getVehicle
Get a vehicle by its UUID.- Parameters:
vehicleUUID
- The UUID of the vehicle.- Returns:
- The
Vehicle
-
doesPlayerOwnVehicles
public static boolean doesPlayerOwnVehicles(@NotNull @NotNull org.bukkit.OfflinePlayer p) Check if a player owns any vehicles.- Parameters:
p
- The player to check for.- Returns:
- true if the player owns vehicles, false if not.
-
getVehicles
@NotNull public static @NotNull List<Vehicle> getVehicles(@NotNull @NotNull org.bukkit.OfflinePlayer p) Get the vehicles owned by this player.- Parameters:
p
- The player who owns the vehicles.- Returns:
- A list of the
Vehicle
s this player owns.
-
getVehicle
@NotNull public static @NotNull Optional<SpawnedVehicle> getVehicle(@NotNull @NotNull org.bukkit.entity.Player p) Get the vehicle a player is driving.- Parameters:
p
- The player who is driving the vehicle.- Returns:
- An
Optional
with theSpawnedVehicle
-
getVehicleFromHolder
@NotNull public static @NotNull Optional<SpawnedVehicle> getVehicleFromHolder(@NotNull @NotNull org.bukkit.entity.ArmorStand stand) Get the vehicle by a holderArmorStand
.- Parameters:
stand
- The holder armorstand.- Returns:
- An
Optional
with theSpawnedVehicle
-
getVehicleFromPart
@NotNull public static @NotNull Optional<SpawnedVehicle> getVehicleFromPart(@NotNull @NotNull org.bukkit.entity.ArmorStand stand) Get the vehicle by a partArmorStand
.- Parameters:
stand
- The part armorstand.- Returns:
- An
Optional
with theSpawnedVehicle
-
getStorageVehicles
Get all theStorageVehicle
s- Returns:
- An
List
with theStorageVehicle
s
-
getSpawnedVehicles
Get all theSpawnedVehicle
s- Returns:
- An
List
with theSpawnedVehicle
s
-
getStorageVehicles
@NotNull public static @NotNull List<StorageVehicle> getStorageVehicles(@NotNull @NotNull org.bukkit.OfflinePlayer p, boolean force) Get the vehicles owned by this player.- Parameters:
p
- The player who owns the vehicles.force
- If true, spawned vehicles will be casted to storage vehicles. If false, it will not return spawned vehicles.- Returns:
- A list of the
StorageVehicle
s this player owns.
-
getSpawnedVehicles
@NotNull public static @NotNull List<SpawnedVehicle> getSpawnedVehicles(@NotNull @NotNull org.bukkit.OfflinePlayer p) Get the spawned vehicles owned by this player.- Parameters:
p
- The player who owns the vehicles.- Returns:
- A list of the
SpawnedVehicle
s this player owns.
-
addGarage
Adds a garage to the garage map. Construct your ownGarage
using the constructor. Make sure to save the garage yourself usingQueuedSavable.save()
!- Parameters:
garage
- TheGarage
to add.force
- Should the garage be overwritten if already in the map?
-
removeGarage
Remove aGarage
from a Player's garages.- Parameters:
name
- TheGarage
to remove.- Returns:
- true if removed, false if not.
-
getPersonalGarage
@NotNull public static @NotNull Garage getPersonalGarage(@NotNull @NotNull org.bukkit.OfflinePlayer player) Get the personal garage of a player. If the player does not have a personal garage, it will create one.- Parameters:
player
- The player to get the garage from.- Returns:
- The
Garage
of the player.
-
getGarages
@NotNull public static @NotNull List<Garage> getGarages(@NotNull @NotNull org.bukkit.OfflinePlayer player) Get the garages the player owns or is member in. -
getGarages
@NotNull public static @NotNull List<Garage> getGarages(@NotNull @NotNull org.bukkit.OfflinePlayer player, boolean ownerOnly) Get the garages the player owns or is member in. -
getGarage
Get a garage by name. -
getGarage
Get a garage by a vehicle. -
registerHook
Register a new API hook. Hooks can be used to run code when the API is loaded.- Parameters:
hook
- The hook to register.
-
registerPart
Register a new custom Part- Parameters:
partClass
- The class of the part. Must extendPart
and be annotated withPartTypeName
.
-
getFuelTypes
All the registered fuel typesKey = FuelTypeID Value = FuelType
-
getRimDesigns
All the registered rim designsKey = RimDesignID Value = RimDesign
-
getVehicleTypes
All the registered vehicle typesKey = TypeID Value = Type
-
getVehicleModels
All the registered vehicle modelsKey = ModelID Value = Model
-
getVehicles
All the vehicles, can be both stored or spawned.Key = Vehicle UUID Value = Vehicle
-
getGarages
All the garages.Key = Garage UUID Value = Garage
-
getHooks
-