# SpawnedVehicle
Date: 2020-04-18

me.legofreak107.vehiclesplus.vehicles.vehicles.objects

## Class SpawnedVehicle

- java.lang.Object
- - me.legofreak107.vehiclesplus.vehicles.vehicles.objects.SpawnedVehicle

    public class SpawnedVehicle
    extends java.lang.Object

### Constructor Summary

Constructors
Constructor and Description
`SpawnedVehicle(StorageVehicle storageVehicle)` Constructor for new spawned vehicle

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `damage(int amount)` Damage the vehicle (If enabled)
`void` `despawn(boolean force)` Despawn a spawned vehicle
`static SpawnedVehicle` `fromString(org.bukkit.entity.ArmorStand holder, java.lang.String input, StorageVehicle storageVehicle)` load the spawnedvehicle based on data string
`int` `getCurrentSpeedInKm()` Get current speed in kilometers an hour
`void` `spawn(org.bukkit.Location loc)` Spawn the spawnedvehicle
`java.lang.String` `toString()` Serialize spawnedvehicle to a string
`void` `update()` Update all positions (parts and skins) Handle collisions.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### SpawnedVehicle

    public SpawnedVehicle(StorageVehicle storageVehicle)

Constructor for new spawned vehicle

Parameters:
  `storageVehicle` - the storage vehicle containing the data to create a new spawned vehicle

### Method Detail

#### spawn

    public void spawn(org.bukkit.Location loc)

Spawn the spawnedvehicle

Parameters:
  `loc` - the location to spawn at

#### despawn

    public void despawn(boolean force)

Despawn a spawned vehicle

#### fromString

    public static SpawnedVehicle fromString(org.bukkit.entity.ArmorStand holder,
                                            java.lang.String input,
                                            StorageVehicle storageVehicle)
                                     throws java.lang.ClassNotFoundException

load the spawnedvehicle based on data string

Parameters:
  `holder` - the armorstand holder of the vehicle
  `input` - the datastring
  `storageVehicle` - the storagevehicle it is linked to
Returns:
  a new SpawnedVehicle class with defined data
Throws:
  `java.lang.ClassNotFoundException` - exception

#### toString

    public java.lang.String toString()

Serialize spawnedvehicle to a string

Overrides:
  `toString` in class `java.lang.Object`
Returns:
  serialized data string

#### update

    public void update()

Update all positions (parts and skins) Handle collisions.

#### damage

    public void damage(int amount)

Damage the vehicle (If enabled)

Parameters:
  `amount` - the amount of damage

#### getCurrentSpeedInKm

    public int getCurrentSpeedInKm()

Get current speed in kilometers an hour

Returns:
  current speed in km/h