Block2Block / HubParkour

A fun Hub Parkour plugin with checkpoints, rewards and more!
Apache License 2.0
9 stars 10 forks source link

HubParkour

Welcome to HubParkour, the ultimate Hub Parkour solution!

Installation

For installation instructions, please follow the instructions located on the spigot page.

Developer API

Using the API as a part of your plugin.

There are 2 methods of including the API in your plugin. You can either attach the JAR as a library in your IDE (not recommended), or you can add a Maven dependency in your pom.xml.

Maven:

<repositories>
       <repository>
            <id>hp-repo</id>
            <url>https://nexus.block2block.me/repository/HubParkour/</url>
        </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>me.block2block.hubparkour</groupId>
        <artifactId>hubparkour-api</artifactId>
        <version>2.7.1</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Note: Old versions of the API have been removed from Nexus as it was causing issues with the current deployment. Please update your API version.

Usage

The JavaDocs can be found here. The main class for the API is HubParkourAPI which can be used to get the player object and other misc things. A full list of methods is available on the JavaDoc page.

There are also several Events that come as a part of the plugin that can be listened to and cancelled. Again, a full list of Events are available in the JavaDocs

Example

import me.block2block.api.HubParkourAPI;
import me.block2block.api.events.player.ParkourPlayerStartEvent;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public class StartListener implements Listener {

    @EventHandler
    public void onStart(ParkourPlayerStartEvent e) {
        if (e.getPlayer().getPlayer().isFlying()) {
            e.setCancelled(true);
            e.getPlayer().getPlayer().sendMessage("You cannot start the parkour if you're flying!");
        }

        Bukkit.getLogger().info(HubParkourAPI.getParkour(1).getName());

    }

}