API
The API is in theme.zombie_striker.qav.api package. QualityArmoryVehicles is the entry point, with static methods for every feature.
Add QualityArmoryVehicles to the depend or softdepend list of your plugin.yml so your plugin loads after it.
Events
Theme.zombie_striker.qav.api.events package has Bukkit events you can listen to:
VehicleHitchEvent and VehicleUnhitchEvent can be cancelled. They give you the vehicle, the animal, the player (it can be null for an unhitch that no player started) and the index of the hitch point.
Hitboxes and seats
These methods were added in 2.6:
A
HitResult gives you the vehicle, the distance, the point in world and local coordinates, and the seat at that point.
Carriages
Custom attachments
Attachments are extra model parts that follow a vehicle. The built-in types areWheel and Turret, and you can add your own.
1. Create the attachment
Extendme.zombie_striker.qav.attachments.Attachment. You must implement animate. You can also override the other methods:
Each vehicle stores the state of its attachments in an
AttachmentState, from vehicle.getAttachmentState(index). It has fields for yaw, spin, the last shot and the last input, and getData() for your own values.
2. Register the type
Register a type to use the attachment in theattachments section of the vehicle files. The factory gets the common options already read (name, id, material and position) and the section of the attachment for your own options. Throw an IllegalArgumentException if an option is not valid: the message is shown in the console.
IllegalArgumentException.
3. Use it in a vehicle file
seat option sets which seat sends its keys to onInput: driver, none or a passenger seat index.
Adding an attachment from code
You can also add an attachment to a vehicle type directly:Folia
On Folia, each vehicle is ticked by the region that owns it. Theupdate, animate and onInput methods of your attachments run on that region’s thread, so only touch entities and blocks near the vehicle from them.