From fe0ccf5d5d585dbe2688d2ddaf1b344a6a918145 Mon Sep 17 00:00:00 2001 From: Cedric Date: Sat, 28 Dec 2024 21:15:13 +0000 Subject: [PATCH 1/3] docs: update vehiclesplus-v3/api --- vehiclesplus-v3/api.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vehiclesplus-v3/api.md b/vehiclesplus-v3/api.md index eba5b3e..474972c 100644 --- a/vehiclesplus-v3/api.md +++ b/vehiclesplus-v3/api.md @@ -2,7 +2,7 @@ title: Getting Started description: Api usage published: false -date: 2024-12-28T21:08:25.669Z +date: 2024-12-28T21:15:10.821Z tags: developers editor: markdown dateCreated: 2024-12-28T20:10:42.650Z @@ -50,6 +50,8 @@ 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 From 3631bcdf8d66aa3fe56db00355941bf449497858 Mon Sep 17 00:00:00 2001 From: Cedric Date: Sat, 28 Dec 2024 21:15:14 +0000 Subject: [PATCH 2/3] docs: rename vehiclesplus-v3/api to vehiclesplus-v3/api/gettingstarted --- vehiclesplus-v3/{api.md => api/gettingstarted.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename vehiclesplus-v3/{api.md => api/gettingstarted.md} (100%) diff --git a/vehiclesplus-v3/api.md b/vehiclesplus-v3/api/gettingstarted.md similarity index 100% rename from vehiclesplus-v3/api.md rename to vehiclesplus-v3/api/gettingstarted.md From 1ed4df81933111419a58bf67904c73f9e0d83850 Mon Sep 17 00:00:00 2001 From: Cedric Date: Sat, 28 Dec 2024 21:16:59 +0000 Subject: [PATCH 3/3] docs: update vehiclesplus-v3/api/gettingstarted --- vehiclesplus-v3/api/gettingstarted.md | 53 +-------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) 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