Swofty-Developments / SwoftyParkour

An advanced configurable 1.16.x Minecraft Plugin meant for making parkours.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swofty Parkour

badge badge badge badge

JavaDoc 1.0.0

An advanced configurable 1.16.x Minecraft Plugin meant for making parkours.

Image of the plugin

Table of contents

Getting started

This API does not support stand-alone usage, and you will need to add the project jar into your plugins folder. An updated version of the API jar can be found inside of the releases tab on the right of this readme. This projects JavaDoc (documentation for every method) can be found here.

Add SwoftyParkour to your project

badge

First, you need to setup the dependency inside of your Java project. Replace VERSION with the version of the release.

Maven

<dependency>
    <groupId>net.swofty</groupId>
    <artifactId>parkour</artifactId>
    <version>VERSION</version>
</dependency>

Gradle

dependencies {
    implementation 'net.swofty:parkour:VERSION'
}

Listening to Plugin Events

To listen to a ParkourEvent, create a class that extends ParkourEventHandler. In this class you will be able to override three main different events;

    public void onParkourStart(ParkourStartEvent e) {}
    public void onCheckpointHit(CheckpointHitEvent e) {}
    public void onParkourEnd(ParkourEndEvent e) {}

Example usage can be found as below;

public class Example extends ParkourEventHandler {

    @Override
    public void onParkourStart(ParkourStartEvent e) {
        Player player = e.getPlayer();
        Location locationOfFirstCheckpoint = e.getParkour().getCheckpoints().get(0);
    }

    @Override
    public void onParkourEnd(ParkourEndEvent e) {
        Player player = e.getPlayer();
        Location locationOfFirstCheckpoint = e.getParkour().getCheckpoints().get(0);
        Long timeSpent = e.getTimeSpent();
    }

    @Override
    public void onCheckpointHit(CheckpointHitEvent e) {
        Player player = e.getPlayer();
        Location locationOfFirstCheckpoint = e.getParkour().getCheckpoints().get(0);
        Long timeSpent = e.getTimeSpent();
        Integer checkPointHit = e.getCheckpointHit();
        Location locationOfHitCheckpoint = e.getParkour().getCheckpoints().get(checkPointHit);
    }

}

To register your class as an eventhandler, merely call #getListenerRegistry on the SwoftyParkourAPI class. An example of use is shown below;

    public static void register() {
        SwoftyParkourAPI.getListenerRegistry().registerEvent(Example.class);
    }

License

SwoftyParkour is licensed under the permissive MIT license. Please see LICENSE.txt for more information.

About

An advanced configurable 1.16.x Minecraft Plugin meant for making parkours.

License:MIT License


Languages

Language:Java 100.0%