API
Javadocs for all classes are here.
Game Management
Game management classes are included in the
To start the game, call the GameManager.startGame()
method.
To end the game, call the GameManager.endGame(gameEndCause)
method with an end cause from the GameEndCause
class.
Access Settings and Configurable Game Vars
Through the following classes:
uk.radialbog9.spigot.manhunt.utils.ManhuntVars
- per-game variablesuk.radialbog9.spigot.manhunt.settings.ManhuntSettings
- configurable settings
Events
In the uk.radialbog9.spigot.manhunt.events
.
ManhuntGameStartEvent
called when the game starts.ManhuntGameEndEvent
called when the game ends.
Scenarios
Adding custom scenarios is quite easy. Create a package for your scenarios, then just create a class for your scenario. Annotate it with the @Scenario
annotation. like in the examples below:
In the classes above, you'll also notice two other things.
Each class is also annotated with either
@ScenarioRunnable
or@ScenarioListener
. This tells Manhunt whether to register this as a runnable or as an event listener. Both can be used at once.Each run or event handler method also has an if statement with
ScenarioUtils.isScenarioEnabled(this)
in. This is a helper method to check if the game is started and if your scenario is enabled. While this isn't strictly required for runnables since they are cancelled when the game ends, it's still good practice to check and is required for listeners since they can't be unregistered.Config is registered as a subclass of your scenario class. If you have a configuration for your scenario (and you must have for runnable scenario), your scenario must also implement
ScenarioConfigurable
. It should extendScenarioConfiguration
and, if it is a runnable, implementRunnableRequiredConfig
.
The scenario name in the annotation does not need to be the same as the class name. It is recommended to begin with your plugin's name as to not conflict with any other scenario. This is the scenario name which will be used in the config and for the language entry.
To register your scenarios, run the following method in your Plugin main class:
To register language, create either a Map<String, String> of your language keys and values, or load into a Properties class, then call the Manhunt.getLanguage().loadLanguage()
method as below:
Last updated