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 class
The builder class for constructingVehicleModel
instances. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAvailableColor
(@NotNull org.bukkit.Color color) Add an available color to the vehicle.static VehicleModel.Builder
builder()
Get a new builder of aVehicleModel
@NotNull UpgradableSetting
The acceleration settings@NotNull nl.sbdeveloper.vehiclesplus.utils.jackson.ColorList
The available colors@NotNull String
The display name of this BaseVehicle, used in chat and inventories@NotNull String
Get the display name.@NotNull Exhaust
The exhaust settings<T extends MovementStrategy,
R>
RgetFromStrategy
(MovementType type, Function<T, R> applyFunction, R defaultValue) Get the value of a specific strategy.@NotNull Fuel
getFuel()
The fuel settings@NotNull UpgradableSetting
The fuel tank settings@NotNull Gearbox
The gearbox settings If null, it means that the vehicle doesn't have a gearbox.int
The health of the vehicle@Nullable HeightLimit
The height limit settings@NotNull Hitbox
The hitbox settings@NotNull Horn
getHorn()
The horn settings@NotNull String
getId()
The ID of this BaseVehicleGet the information list of this vehicle.@NotNull UpgradableSetting
The max speed settings<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 parts that this BaseVehicle has<V> @NotNull List
<V> Get all the parts of a specific type.@NotNull Permissions
The permission settingsdouble
getPrice()
The price of this vehicle@NotNull Sounds
The sound settingsint
The size of the trunk@NotNull UpgradableSetting
The turning radius settings@NotNull VehicleType
getType()
Get the type of this vehicle.@NotNull String
The type that this BaseVehicle is@NotNull List
<MovementStrategy> boolean
isAllowedToAdjust
(@NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to adjust this vehicle.boolean
isAllowedToBuy
(@NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to buy this vehicle.boolean
isAllowedToDrive
(@NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to drive this vehicle.boolean
isAllowedToRide
(@NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to ride this vehicle.boolean
isAllowedToSpawn
(@NotNull org.bukkit.entity.Player player) Helper function to check if a player is allowed to spawn this vehicle.boolean
isDrift()
Is the vehicle allowed to drift?boolean
The exit while moving propertyboolean
Is steering realistic?void
setDisplayName
(@NotNull String displayName) The display name of this BaseVehicle, used in chat and inventoriesvoid
setDrift
(boolean drift) Is the vehicle allowed to drift?void
setExitWhileMoving
(boolean exitWhileMoving) The exit while moving propertyvoid
setGearbox
(@NotNull Gearbox gearbox) The gearbox settings If null, it means that the vehicle doesn't have a gearbox.void
setHealth
(int health) The health of the vehiclevoid
The ID of this BaseVehiclevoid
setPermissions
(@NotNull Permissions permissions) The permission settingsvoid
setPrice
(double price) The price of this vehiclevoid
setRealisticSteering
(boolean realisticSteering) Is steering realistic?void
setTrunkSize
(int trunkSize) The size of the trunkvoid
The 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:
getFromStrategy
in 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.
-