-
Notifications
You must be signed in to change notification settings - Fork 10
API
to reference this code in a maven project, add the following to your pom.xml
<dependency>
<groupId>io.github.dailystruggle</groupId>
<artifactId>RTP</artifactId>
<version>INSERT_VERSION</version>
<scope>provided</scope>
</dependency>
RTP uses a number of custom spigot events, allowing other plugins to listen in.
- PlayerQueuePopEvent - when a player is selected for teleportation
- PlayerQueuePushEvent - when a player begins waiting for a new location to generate
- PostLoadChunksEvent - after chunk preload task
- PostSetupTeleportEvent - after selection tasks
- PostTeleportEvent - after teleportation task
- PreLoadChunksEvent - before chunk preload task
- PreSetupTeleportEvent - before selection task
- PreTeleportEvent - before teleportation task
- RandomSelectQueueEvent - when the plugin prepares a location asynchronously
- TeleportCancelEvent - when a player cancels teleportation
- TeleportCommandFailEvent - when a teleport command fails
- TeleportCommandSuccessEvent - when a teleport command succeeds
In an event listener, reference any event getters and run necessary code.
public final class OnRandomTeleport implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onRandomTeleport(PostTeleportEvent event) {
if(configs.config.platformRadius>=0) {
Bukkit.getScheduler().runTask(plugin, ()->makePlatform(event.getTo()));
}
}
}
Highest priority should make this run last, in case the location is modified by another listener. In this case, I want to make a platform later.
and I register the listener normally in my main plugin file
getServer().getPluginManager().registerEvents(new OnRandomTeleport(),this);
You may want to reference or modify a specific region.
Region region = RTP.selectionAPI.getRegion(String regionName)
This plugin keeps a list of method handles for location checking. You can also add arbitrary location checks from various plugins.
Checks can be added by calling Region.addGlobalRegionVerifier() with an appropriate function.
If you want to add or replace a sub-command with its own permission, commands, and parameters, you can create custom commands using an included command API, like this:
RTP.baseCommand.addSubCommand(command);
As of 2.0.0, parameter decoding is automated. Reference this package or BukkitTreeCommand for implementing a new subcommand