Class VehicleDataConfig
java.lang.Object
nl.mtvehicles.core.infrastructure.models.MTVConfig
nl.mtvehicles.core.infrastructure.dataconfig.VehicleDataConfig
Methods for supersecretsettings.yml.
Do not initialise this class directly. Use
Do not initialise this class directly. Use
ConfigModule.vehicleDataConfig
instead.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Options available in vehicle data file -
Field Summary
Fields inherited from class nl.mtvehicles.core.infrastructure.models.MTVConfig
config, configType
-
Constructor Summary
ConstructorDescriptionDefault constructor - do not use this.
UseConfigModule.vehicleDataConfig
instead. -
Method Summary
Modifier and TypeMethodDescriptionvoid
damageVehicle(String license, double damage)
Damage a vehicle.void
Delete a vehicle from vehicleDataget(String licensePlate, VehicleDataConfig.Option dataOption)
Get a data option of a vehicle from vehicleDataint
Get the durability of a vehicle item.int
Get the durability of a vehicle item.double
Get health of a vehiclegetMembers(String licensePlate)
Get UUIDs of players which may sit in the vehicleint
getNumberOfOwnedVehicles(org.bukkit.entity.Player p)
Get number of vehicles owned by a playerGet UUIDs of players which may steer the vehiclegetTrunkData(String licensePlate)
Get data of the vehicle's trunkGet the type (enum) of the vehicle.org.bukkit.configuration.ConfigurationSection
Get (basically) the whole file.boolean
isEmpty()
Whether the vehicleData.yml file is emptyboolean
isHealthSet(String license)
Check whether 'health' data option is set (it might not be if player was using an older version of MTV before)boolean
isHornEnabled(String license)
Check whether horn may be used in a vehicleboolean
Check whether 'hornEnabled' data option is set (it might not be if player was using an older version of MTV before)void
set(String licensePlate, VehicleDataConfig.Option dataOption, Object value)
Set a data option of a vehicle to vehicleDatavoid
Set health of a vehiclevoid
setInitialHealth(String license)
Set the 'health' data option default value.void
setInitialHorn(String license)
Set the 'hornEnabled' data option default value.Methods inherited from class nl.mtvehicles.core.infrastructure.models.MTVConfig
getConfig, getConfiguration, reload, save, saveDefaultConfig, setConfigFile, setFileName
-
Constructor Details
-
VehicleDataConfig
public VehicleDataConfig()Default constructor - do not use this.
UseConfigModule.vehicleDataConfig
instead.
-
-
Method Details
-
get
Get a data option of a vehicle from vehicleData- Parameters:
licensePlate
- Vehicle's license platedataOption
- Data option of a vehicle- Returns:
- Value of the option (as Object)
-
set
Set a data option of a vehicle to vehicleData- Parameters:
licensePlate
- Vehicle's license platedataOption
- Data option of a vehiclevalue
- New value of the option (should be the same type!)
-
delete
Delete a vehicle from vehicleData- Parameters:
licensePlate
- Vehicle's license plate- Throws:
IllegalStateException
- If vehicle is already deleted.
-
isEmpty
public boolean isEmpty()Whether the vehicleData.yml file is empty -
getVehicles
public org.bukkit.configuration.ConfigurationSection getVehicles()Get (basically) the whole file. -
getDamage
Get the durability of a vehicle item.- Parameters:
licensePlate
- Vehicle's license plate
-
getDamage
Get the durability of a vehicle item.- Parameters:
vehicle
- Vehicle
-
getMembers
Get UUIDs of players which may sit in the vehicle- Parameters:
licensePlate
- Vehicle's license plate
-
getRiders
Get UUIDs of players which may steer the vehicle- Parameters:
licensePlate
- Vehicle's license plate
-
getTrunkData
Get data of the vehicle's trunk- Parameters:
licensePlate
- Vehicle's license plate- Returns:
- List of items in the trunk (as Strings)
-
getType
Get the type (enum) of the vehicle.- Parameters:
licensePlate
- Vehicle's license plate
-
isHornEnabled
Check whether horn may be used in a vehicle- Parameters:
license
- Vehicle's license plate
-
isHornSet
Check whether 'hornEnabled' data option is set (it might not be if player was using an older version of MTV before)- Parameters:
license
- Vehicle's license plate
-
setInitialHorn
Set the 'hornEnabled' data option default value.- Parameters:
license
- Vehicle's license plate
-
getHealth
Get health of a vehicle- Parameters:
license
- Vehicle's license plate
-
isHealthSet
Check whether 'health' data option is set (it might not be if player was using an older version of MTV before)- Parameters:
license
- Vehicle's license plate
-
setInitialHealth
Set the 'health' data option default value.- Parameters:
license
- Vehicle's license plate
-
damageVehicle
Damage a vehicle.- Parameters:
license
- Vehicle's license platedamage
- Amount of damage
-
setHealth
Set health of a vehicle- Parameters:
license
- Vehicle's license platehealth
- New health
-
getNumberOfOwnedVehicles
public int getNumberOfOwnedVehicles(org.bukkit.entity.Player p)Get number of vehicles owned by a player- Parameters:
p
- Player
-