API
Please keep in mind that this wiki only shows a limited selection of methods, functions and possibilites.
For further questions regarding the development of addons, methods, or just general questions about what is possible, ask us on our discord server. Do read the entire page here though.
Using the API
Step 1:
Create a /libs
folder in your project, and drag and drop the Vehicles jar into the folder.
Step 2:
Add the following to your pom.xml
if you are using Maven:
Depending on how you called your Vehicles.jar
, you may also need to change that part in the systemPath
.
Step 3:
You can now use the Vehicles API. Don't forget to add Vehicles as a dependency to your plugin.yml
The Vehicle
object is a custom one. It is not the same as the org.bukkit.entity
Vehicle. Please make sure to import the correct Vehicle:
Limitations of the API
No custom Vehicles
As our FAQ already hinted towards, you can't create your own Vehicles with this plugin. Not even using the API.
No automatic Vehicle movement
You can't force Vehicles to follow a specific path (eg: like TrainCarts).
Want something added?
Tell us on our discord and the developer can see what is possible. Don't ask about new Vehicles though =).
Movement tracking is resource intensive
Default MoveEvents from Bukkit and other checks don't work, as only the armorstand moves. ProtocolLib offers a VehicleSteerPacket, which can register the movement.
Available Events
VehicleEnterEvent
This event gets fired when a player right clicks a Vehicle to mount it. You can not manually fire this event.
VehicleExitEvent
This event gets fired when a player tries to dismount a Vehicle. You can not manually fire this event.
VehiclePickupEvent
This event gets fired when a player tries to pick a Vehicle up. You can not manually fire this event.
VehiclePlaceEvent
This event gets fire when a player tries to place a Vehicle. You can not manually fire this event.
VehicleSpawnedEvent
This event gets fired AFTER a Vehicle has been spawned and AFTER the VehiclePlaceEvent has been. You can not manually fire this event.
VehicleInventoryOpenEvent
This event gets fired when a player is trying to open the trunk of a Vehicle. You can not manually fire this event.
VehicleCollideEvent
This event gets fired whenever a Vehicle encounters a block that it can not drive up. You can not manually fire this event.
General API Methods
The following code selections are based off of the VehiclesMain instance:
Get current mounted Vehicle from Player
Generate subtype from String
Get all current mounted Vehicles as a Hashmap
Get other config options:
Theres a bit more...
Ask us on the Discord and we can surely help you find a solution you need!
The following code selections are generalised and should give insight on what info you can get/set from Vehicles. Please keep in mind, that you call these methods with a Vehicle object.
Get the mainstand
of a Vehicle
Edit Vehicle stats
Get current Players on Vehicle
Get Type / Subtype of Vehicle
Code Examples
Last updated