diff --git a/vehiclesplus-v3/api/gettingstarted.md b/vehiclesplus-v3/api/gettingstarted.md index 474972c..abc599e 100644 --- a/vehiclesplus-v3/api/gettingstarted.md +++ b/vehiclesplus-v3/api/gettingstarted.md @@ -2,7 +2,7 @@ title: Getting Started description: Api usage published: false -date: 2024-12-28T21:15:10.821Z +date: 2024-12-28T21:16:56.592Z tags: developers editor: markdown dateCreated: 2024-12-28T20:10:42.650Z @@ -52,57 +52,6 @@ dependencies { > **Note**: Using `latest` ensures that your project always fetches the most recent release, but it might cause issues if breaking changes are introduced. For more stability, consider specifying a specific version (e.g., `3.0.2`). {.is-info} - -## Example: Adding a Car to Someone's Garage - -This example demonstrates how to add a vehicle to any garage: - -```java -// Give car to garage -public void giveCar(Garage garage, String vehicleType) { - // Attempt to create a vehicle - StorageVehicle vehicle = VehiclesPlusAPI.createVehicle(vehicleType); - - if (vehicle == null) { - System.err.println("Failed to create vehicle of type: " + vehicleType); - return; // Exit if the vehicle could not be created - } - - // Add the vehicle's UUID to the garage - garage.addVehicle(vehicle.getUuid()); - System.out.println("Vehicle created and added to the garage successfully."); -} -``` - -## Example: Adding a Vehicle to the Player's Default Garage - -This example demonstrates how to add a vehicle to the player's default garage: - -```java -// Give car to player's default garage -public void giveCar(Player player, String vehicleType) { - // Attempt to create a vehicle - StorageVehicle vehicle = VehiclesPlusAPI.createVehicle(vehicleType); - - // Retrieve the player's default garage - Optional optionalGarage = VehiclesPlusAPI.getGarage(player.getName()); - - if (vehicle == null) { - System.err.println("Failed to create vehicle of type: " + vehicleType); - return; // Exit if the vehicle could not be created - } - - if (optionalGarage.isPresent()) { - Garage garage = optionalGarage.get(); - garage.addVehicle(vehicle.getUuid()); - System.out.println("Vehicle created and added to the garage successfully."); - } else { - System.err.println("Garage not found for player: " + player.getName()); - // Optionally, you could create a new garage for the player here if the API allows it. - } -} -``` - ## API Documentation For additional details and advanced usage refer to the official [VehiclesPlus Javadoc](https://sbdevelopment.tech/javadoc/vehiclesplus-v3/index.html). \ No newline at end of file