Class VehicleModel

java.lang.Object
nl.sbdeveloper.vehiclesplus.utils.Builder
nl.sbdeveloper.vehiclesplus.api.vehicles.VehicleModel
All Implemented Interfaces:
IVehicle

public class VehicleModel extends nl.sbdeveloper.vehiclesplus.utils.Builder implements IVehicle
This class contains all the information about a vehicle type. You can create VehicleModels by adding a config file.
  • Method Details

    • builder

      public static VehicleModel.Builder builder()
      Get a new builder of a VehicleModel
      Returns:
      A new builder
    • getType

      @NotNull public @NotNull VehicleType getType()
      Get the type of this vehicle.
      Returns:
      The vehicle type.
    • getDisplayNameColored

      @NotNull public @NotNull String getDisplayNameColored()
      Get the display name. This also includes ChatColor.
      Returns:
      The display name.
    • getPart

      @Nullable public <V> V getPart(@NotNull @NotNull Class<V> partClass)
      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

      @NotNull public <V> @NotNull List<V> getParts(@NotNull @NotNull Class<V> partClass)
      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

      @Nullable public @Nullable Part getPart(org.bukkit.entity.ArmorStand stand)
      Get a part from the holder stand.
      Parameters:
      stand - The holder stand.
      Returns:
      The part.
    • getInfoList

      @NotNull public @NotNull List<String> 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 interface IVehicle
      Type Parameters:
      T - The type of the strategy
      R - The return type of the function
      Parameters:
      type - The type of the strategy
      applyFunction - The function to call to get the value
      defaultValue - 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

      public String toString()
      Overrides:
      toString in class Object
    • getId

      @NotNull public @NotNull String getId()
      The ID of this BaseVehicle
    • setId

      public void setId(@NotNull @NotNull String id)
      The ID of this BaseVehicle
    • getDisplayName

      @NotNull public @NotNull String getDisplayName()
      The display name of this BaseVehicle, used in chat and inventories
    • setDisplayName

      public void setDisplayName(@NotNull @NotNull String displayName)
      The display name of this BaseVehicle, used in chat and inventories
    • getTypeId

      @NotNull public @NotNull String getTypeId()
      The type that this BaseVehicle is
    • setTypeId

      public void setTypeId(@NotNull @NotNull String typeId)
      The type that this BaseVehicle is
    • getTypeStrategies

      @NotNull public @NotNull List<MovementStrategy> getTypeStrategies()
    • getPrice

      public double getPrice()
      The price of this vehicle
    • setPrice

      public void setPrice(double price)
      The price of this vehicle
    • getPermissions

      @NotNull public @NotNull Permissions getPermissions()
      The permission settings
    • setPermissions

      public void setPermissions(@NotNull @NotNull Permissions permissions)
      The permission settings
    • getAvailableColors

      @NotNull public @NotNull nl.sbdeveloper.vehiclesplus.utils.jackson.ColorList getAvailableColors()
      The available colors
    • getParts

      @NotNull public @NotNull List<Part> getParts()
      The parts that this BaseVehicle has
    • getMaxSpeed

      @NotNull public @NotNull UpgradableSetting getMaxSpeed()
      The max speed settings
    • getFuelTank

      @NotNull public @NotNull UpgradableSetting getFuelTank()
      The fuel tank settings
    • getTurningRadius

      @NotNull public @NotNull UpgradableSetting getTurningRadius()
      The turning radius settings
    • getAcceleration

      @NotNull public @NotNull UpgradableSetting getAcceleration()
      The acceleration settings
    • getHitbox

      @NotNull public @NotNull Hitbox getHitbox()
      The hitbox settings
    • getFuel

      @NotNull public @NotNull Fuel getFuel()
      The fuel settings
    • getExhaust

      @NotNull public @NotNull Exhaust getExhaust()
      The exhaust settings
    • getHorn

      @NotNull public @NotNull Horn getHorn()
      The horn settings
    • getSounds

      @NotNull public @NotNull Sounds getSounds()
      The sound settings
    • getHeightLimit

      @Nullable public @Nullable HeightLimit 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

      @NotNull public @NotNull Gearbox getGearbox()
      The gearbox settings If null, it means that the vehicle doesn't have a gearbox.
    • setGearbox

      public void setGearbox(@NotNull @NotNull Gearbox gearbox)
      The gearbox settings If null, it means that the vehicle doesn't have a gearbox.