Class VehicleModel
java.lang.Object
nl.sbdeveloper.vehiclesplus.utils.Builder
nl.sbdeveloper.vehiclesplus.api.vehicles.VehicleModel
- All Implemented Interfaces:
IVehicle
This class contains all the information about a vehicle type.
You can create VehicleModels by adding a config file.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe builder class for constructingVehicleModelinstances. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAvailableColor(@NotNull org.bukkit.Color color) Add an available color to the vehicle.static VehicleModel.Builderbuilder()Get a new builder of aVehicleModel@NotNull UpgradableSettingThe acceleration settings@NotNull nl.sbdeveloper.vehiclesplus.utils.jackson.ColorListThe available colors@NotNull StringThe display name of this BaseVehicle, used in chat and inventories@NotNull StringGet the display name.@NotNull ExhaustThe exhaust settings<T extends MovementStrategy,R>
RgetFromStrategy(MovementType type, Function<T, R> applyFunction, R defaultValue) Get the value of a specific strategy.@NotNull FuelgetFuel()The fuel settings@NotNull UpgradableSettingThe fuel tank settings@NotNull GearboxThe gearbox settings If null, it means that the vehicle doesn't have a gearbox.intThe health of the vehicle@Nullable HeightLimitThe height limit settings@NotNull HitboxThe hitbox settings@NotNull HorngetHorn()The horn settings@NotNull StringgetId()The ID of this BaseVehicleGet the information list of this vehicle.@NotNull UpgradableSettingThe max speed settings<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 parts that this BaseVehicle has<V> @NotNull List<V> Get all the parts of a specific type.@NotNull PermissionsThe permission settingsdoublegetPrice()The price of this vehicle@NotNull SoundsThe sound settingsintThe size of the trunk@NotNull UpgradableSettingThe turning radius settings@NotNull VehicleTypegetType()Get the type of this vehicle.@NotNull StringThe type that this BaseVehicle is@NotNull List<MovementStrategy> booleanisAllowedToAdjust(@NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to adjust this vehicle.booleanisAllowedToBuy(@NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to buy this vehicle.booleanisAllowedToDrive(@NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to drive this vehicle.booleanisAllowedToRide(@NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to ride this vehicle.booleanisAllowedToSpawn(@NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to spawn this vehicle.booleanisDrift()Is the vehicle allowed to drift?booleanThe exit while moving propertybooleanIs steering realistic?voidsetDisplayName(@NotNull String displayName) The display name of this BaseVehicle, used in chat and inventoriesvoidsetDrift(boolean drift) Is the vehicle allowed to drift?voidsetExitWhileMoving(boolean exitWhileMoving) The exit while moving propertyvoidsetGearbox(@NotNull Gearbox gearbox) The gearbox settings If null, it means that the vehicle doesn't have a gearbox.voidsetHealth(int health) The health of the vehiclevoidThe ID of this BaseVehiclevoidsetPermissions(@NotNull Permissions permissions) The permission settingsvoidsetPrice(double price) The price of this vehiclevoidsetRealisticSteering(boolean realisticSteering) Is steering realistic?voidsetTrunkSize(int trunkSize) The size of the trunkvoidThe type that this BaseVehicle istoString()Methods inherited from class nl.sbdeveloper.vehiclesplus.utils.Builder
validateNonNullFields
-
Method Details
-
builder
Get a new builder of aVehicleModel- Returns:
- A new builder
-
getType
Get the type of this vehicle.- Returns:
- The vehicle type.
-
getDisplayNameColored
Get the display name. This also includesChatColor.- Returns:
- The display name.
-
getPart
Get the first occurrence of a specific type.- 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
Get all the parts of a specific type.- Type Parameters:
V- The part itself.- Parameters:
partClass- The class of the part.- Returns:
- A list of all the parts of that type.
-
getPart
Get a part from the holder stand.- Parameters:
stand- The holder stand.- Returns:
- The part.
-
getInfoList
Get the information list of this vehicle. This includes the max speed, acceleration, fuel tank and turning radius.- Returns:
- A list of information strings.
-
getFromStrategy
public <T extends MovementStrategy,R> R getFromStrategy(MovementType type, Function<T, R> applyFunction, @NotNull R defaultValue) Get the value of a specific strategy.- Specified by:
getFromStrategyin interfaceIVehicle- Type Parameters:
T- The type of the strategyR- The return type of the function- Parameters:
type- The type of the strategyapplyFunction- The function to call to get the valuedefaultValue- The default value to return if the strategy is not found- Returns:
- The value from the strategy
-
isAllowedToBuy
public boolean isAllowedToBuy(@NotNull @NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to buy this vehicle.- Parameters:
player- The player to check- Returns:
- If the player is allowed to buy this vehicle
-
isAllowedToAdjust
public boolean isAllowedToAdjust(@NotNull @NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to adjust this vehicle.- Parameters:
player- The player to check- Returns:
- If the player is allowed to adjust this vehicle
-
isAllowedToSpawn
public boolean isAllowedToSpawn(@NotNull @NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to spawn this vehicle.- Parameters:
player- The player to check- Returns:
- If the player is allowed to spawn this vehicle
-
isAllowedToRide
public boolean isAllowedToRide(@NotNull @NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to ride this vehicle.- Parameters:
player- The player to check- Returns:
- If the player is allowed to ride this vehicle
-
isAllowedToDrive
public boolean isAllowedToDrive(@NotNull @NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to drive this vehicle.- Parameters:
player- The player to check- Returns:
- If the player is allowed to drive this vehicle
-
addAvailableColor
public void addAvailableColor(@NotNull @NotNull org.bukkit.Color color) Add an available color to the vehicle.- Parameters:
color- The color to add
-
toString
-
getId
The ID of this BaseVehicle -
setId
The ID of this BaseVehicle -
getDisplayName
The display name of this BaseVehicle, used in chat and inventories -
setDisplayName
The display name of this BaseVehicle, used in chat and inventories -
getTypeId
The type that this BaseVehicle is -
setTypeId
The type that this BaseVehicle is -
getTypeStrategies
-
getPrice
public double getPrice()The price of this vehicle -
setPrice
public void setPrice(double price) The price of this vehicle -
getPermissions
The permission settings -
setPermissions
The permission settings -
getAvailableColors
@NotNull public @NotNull nl.sbdeveloper.vehiclesplus.utils.jackson.ColorList getAvailableColors()The available colors -
getParts
The parts that this BaseVehicle has -
getMaxSpeed
The max speed settings -
getFuelTank
The fuel tank settings -
getTurningRadius
The turning radius settings -
getAcceleration
The acceleration settings -
getHitbox
The hitbox settings -
getFuel
The fuel settings -
getExhaust
The exhaust settings -
getHorn
The horn settings -
getSounds
The sound settings -
getHeightLimit
The height limit settings -
isRealisticSteering
public boolean isRealisticSteering()Is steering realistic? -
setRealisticSteering
public void setRealisticSteering(boolean realisticSteering) Is steering realistic? -
getTrunkSize
public int getTrunkSize()The size of the trunk -
setTrunkSize
public void setTrunkSize(int trunkSize) The size of the trunk -
isDrift
public boolean isDrift()Is the vehicle allowed to drift? -
setDrift
public void setDrift(boolean drift) Is the vehicle allowed to drift? -
isExitWhileMoving
public boolean isExitWhileMoving()The exit while moving property -
setExitWhileMoving
public void setExitWhileMoving(boolean exitWhileMoving) The exit while moving property -
getHealth
public int getHealth()The health of the vehicle -
setHealth
public void setHealth(int health) The health of the vehicle -
getGearbox
The gearbox settings If null, it means that the vehicle doesn't have a gearbox. -
setGearbox
The gearbox settings If null, it means that the vehicle doesn't have a gearbox.
-