The FactionCarSpawner plugin is a Spigot plugin designed to provide players with the ability to spawn and despawn vehicles using the
VehiclesPlus plugin, offering easy vehicle management within a faction-based server. This plugin is built using reflection, allowing it to be compatible with different versions of
VehiclesPlus. It also integrates with Minecraft’s permissions system, so only authorized players can spawn and interact with vehicles.
This plugin allows faction leaders or specific players to spawn different types of vehicles (like cars, ambulances, etc.) based on configuration files. These vehicles are "faction cars" that players can use to travel around the server. Additionally, players can despawn their vehicles at any time, keeping the server environment clean.
Key Features
Vehicle Spawning: Players can spawn vehicles that are predefined in the configuration file (config.yml).
Vehicle Despawning: Players can despawn their vehicles at any time.
Permission-based System: Players need the correct permissions to spawn specific vehicles, ensuring only authorized players can use them.
Support for Multiple Vehicle Types: Through integration with VehiclesPlus, various vehicles can be spawned using the internal vehicle identifier.
Reflection Support: The plugin uses reflection to ensure compatibility with different versions of VehiclesPlus.
Installation & Requirements Requirements:
Spigot or Paper Server: This plugin is intended to be used on a Spigot-based Minecraft server.
VehiclesPlus Plugin: The VehiclesPlus plugin must be installed and properly configured. The plugin uses reflection to interact with VehiclesPlus, so it needs to be compatible with the version of VehiclesPlus you're using.
Installation Steps:
Download the FactionCarSpawner plugin and place it in the plugins directory of your Spigot server.
Ensure that VehiclesPlus is also installed on your server.
Restart the server to load both plugins.
Configuration The plugin's behavior is controlled by the config.yml file, which you can find in the plugin’s directory after you run the plugin for the first time. The configuration file contains entries for each vehicle you want to spawn. A sample configuration might look like this:
permission: The permission required to spawn the vehicle. Players need this permission to use the vehicle. It follows the pattern factioncar.<permission>.
name: The display name used in the game. This is what players will type when they use the /factioncar spawn <name> command.
car-name: The internal vehicle identifier used by VehiclesPlus. This refers to the vehicle’s internal name (like "ambulance" or "fighterjet") which is used for spawning the actual vehicle.
Commands The plugin provides several commands for managing vehicles:
/factioncar spawn
Spawns a vehicle for the player based on the vehicle's name in the config.
Usage: /factioncar spawn Medic
Permission: Players need the permission factioncar.<vehicle-permission> (as defined in the config.yml).
Example: If a player has the permission factioncar.mediccar, they can spawn the vehicle called "Medic" from the configuration.
/factioncar despawn
Despawns the vehicle that the player currently owns or is sitting in.
Usage: /factioncar despawn
Permission: Any player with a vehicle spawned can despawn it.
/factioncar reload
Reloads the plugin’s configuration (config.yml), which is useful if you make changes to the vehicle definitions without restarting the server.
Usage: /factioncar reload
Permission: No specific permission required to reload the config.
Tab Completion To make it easier for players to use commands, the plugin also provides tab completion for the /factioncar commands:
When typing /factioncar spawn, it will show the available vehicle names (from the name field in config.yml).
After typing /factioncar despawn, it suggests the option current, as this is the only option available when despawning a vehicle.
/factioncar reload has no tab-completion, as it is a standalone command.
How to Use 1. Spawning a Vehicle
First, ensure the vehicle you want to spawn is defined in the config.yml file.
Ensure you have the appropriate permissions to spawn the vehicle. For example, if you want to spawn a "Medic" car, you need the factioncar.mediccar permission.
Use the command /factioncar spawn <vehicle-name>. For instance, /factioncar spawn Medic will spawn the vehicle named "Medic" at your current location.
2. Despawning a Vehicle
If you no longer need the vehicle or want to remove it, simply use the command /factioncar despawn. This will remove your current vehicle from the world.
If you leave the server, your vehicle will automatically be despawned to ensure the world doesn’t get cluttered with unused vehicles.
3. Reloading Configuration
If you make changes to the config.yml file (like adding new vehicles or changing their permissions), you can reload the configuration without restarting the server by using the /factioncar reload command.
Additional Features
Permission System: The plugin integrates with Minecraft's permission system. Players need to have the specific permission (as set in the config.yml file) to spawn a particular vehicle. For example, only players with factioncar.mediccar can spawn the "Medic" car.
Compatibility: The plugin uses reflection to work with different versions of VehiclesPlus, making it compatible with various versions of the plugin. The vehicle spawning logic is dynamically handled based on the version of VehiclesPlus installed.
Clean Despawn on Logout: If a player logs out while in a vehicle, the plugin will automatically despawn the vehicle, preventing it from lingering in the world and cluttering the server.
Troubleshooting
"VehiclesPlus not found": If you see an error stating that VehiclesPlus is not found, make sure the plugin is properly installed and that the version is compatible with your server.
Permissions: If players are unable to spawn vehicles, double-check the permissions in your config.yml and ensure that players have the correct permissions.
Vehicles Not Spawning: If vehicles are not spawning, verify that the vehicle's internal name (car-name in the config) matches the name used by VehiclesPlus. You may need to refer to the documentation of VehiclesPlus to ensure compatibility.