Class VehicleDataConfig

java.lang.Object
nl.mtvehicles.core.infrastructure.models.MTVConfig
nl.mtvehicles.core.infrastructure.dataconfig.VehicleDataConfig

public class VehicleDataConfig extends MTVConfig
Methods for supersecretsettings.yml.
Do not initialise this class directly. Use ConfigModule.vehicleDataConfig instead.
  • Constructor Details

  • Method Details

    • get

      public Object get(String licensePlate, VehicleDataConfig.Option dataOption)
      Get a data option of a vehicle from vehicleData
      Parameters:
      licensePlate - Vehicle's license plate
      dataOption - Data option of a vehicle
      Returns:
      Value of the option (as Object)
    • set

      public void set(String licensePlate, VehicleDataConfig.Option dataOption, Object value)
      Set a data option of a vehicle to vehicleData
      Parameters:
      licensePlate - Vehicle's license plate
      dataOption - Data option of a vehicle
      value - New value of the option (should be the same type!)
    • delete

      public void delete(String licensePlate) throws IllegalStateException
      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

      public int getDamage(String licensePlate)
      Get the durability of a vehicle item.
      Parameters:
      licensePlate - Vehicle's license plate
    • getDamage

      public int getDamage(Vehicle vehicle)
      Get the durability of a vehicle item.
      Parameters:
      vehicle - Vehicle
    • getMembers

      public List<String> getMembers(String licensePlate)
      Get UUIDs of players which may sit in the vehicle
      Parameters:
      licensePlate - Vehicle's license plate
    • getRiders

      public List<String> getRiders(String licensePlate)
      Get UUIDs of players which may steer the vehicle
      Parameters:
      licensePlate - Vehicle's license plate
    • getTrunkData

      public List<String> getTrunkData(String licensePlate)
      Get data of the vehicle's trunk
      Parameters:
      licensePlate - Vehicle's license plate
      Returns:
      List of items in the trunk (as Strings)
    • getType

      public VehicleType getType(String licensePlate)
      Get the type (enum) of the vehicle.
      Parameters:
      licensePlate - Vehicle's license plate
    • isHornEnabled

      public boolean isHornEnabled(String license)
      Check whether horn may be used in a vehicle
      Parameters:
      license - Vehicle's license plate
    • isHornSet

      public boolean isHornSet(String license)
      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

      public void setInitialHorn(String license)
      Set the 'hornEnabled' data option default value.
      Parameters:
      license - Vehicle's license plate
    • getHealth

      public double getHealth(String license)
      Get health of a vehicle
      Parameters:
      license - Vehicle's license plate
    • isHealthSet

      public boolean isHealthSet(String license)
      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

      public void setInitialHealth(String license)
      Set the 'health' data option default value.
      Parameters:
      license - Vehicle's license plate
    • damageVehicle

      public void damageVehicle(String license, double damage)
      Damage a vehicle.
      Parameters:
      license - Vehicle's license plate
      damage - Amount of damage
    • setHealth

      public void setHealth(String license, double health)
      Set health of a vehicle
      Parameters:
      license - Vehicle's license plate
      health - New health
    • getNumberOfOwnedVehicles

      public int getNumberOfOwnedVehicles(org.bukkit.entity.Player p)
      Get number of vehicles owned by a player
      Parameters:
      p - Player