Skip to content

The most modern and support friendly public SpigotAPI

Notifications You must be signed in to change notification settings

RefineDevelopment/SpigotAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

00e2c6f · Sep 29, 2024

History

38 Commits
Sep 15, 2022
Jan 10, 2024
Sep 13, 2024
Sep 13, 2024
Jan 10, 2024
Dec 1, 2023
Jan 10, 2024
Sep 29, 2024
Jan 10, 2024
Jan 15, 2024
Jun 20, 2024
Jan 20, 2024
May 30, 2022
Feb 18, 2023
Sep 13, 2024
Sep 13, 2024

Repository files navigation

SpigotAPI

The most modern and support friendly public SpigotAPI (1.8 only)

This SpigotAPI supports KnockbackAPI from different spigot forks, along with helping the issue of EntityHider with spigots that don't have it. Also, useful if you need PotionExpireEvent or EquipmentSetEvent.

Features

  • Support for popular spigots.
  • Support for HCF Bukkit Events. (PotionExpireEvent, EquipmentSetEvent)
  • Custom Entity Hider using protocol lib.
  • Easy to use.

Installing

You need to shade this repository in your plugin.

  1. Clone this repository
  2. Enter the directory: cd SpigotAPI
  3. Build & install with Maven: mvn clean package install

OR

<repositories>
    <repository>
        <id>refine-public</id>
        <url>https://maven.refinedev.xyz/public-repo</url>
    </repository>
</repositories>

Next, add SpigotAPI to your project's dependencies via Maven

Add this to your pom.xml <dependencies>:

<dependency>
  <groupId>xyz.refinedev.api</groupId>
  <artifactId>SpigotAPI</artifactId>
  <version>1.7</version>
  <scope>compile</scope>
</dependency>

Usage

This only requires ProtocolLib if you use the API's EntityHider. You can initiate and set up the API using the following code:

import xyz.refinedev.api.spigot.SpigotHandler;
import xyz.refinedev.api.spigot.SpigotType;

public class ExamplePlugin extends JavaPlugin {

    private SpigotHandler spigotHandler;

    @Override
    public void onEnable() {
        this.spigotHandler = new SpigotHandler(instance);
        // This will automatically detect if Entity Hider is needed or not.
        // If it's needed, then it'll register it accordingly.
        this.spigotHandler.init(true); // Boolean is for HCF mode.

        SpigotType type = this.spigotHandler.getType();
        if (type != SpigotType.Default) {
            this.getLogger().info("Found " + type.getName() + ", hooking in for support, HCF-TeamFights will be supported.");
        }
        
        // Usage can be like so
        Player player = Bukkit.getPlayer("NotDrizzy"); // your player object
        this.spigotHandler.getKnockback().setKnockback(player, "knockback name");
    }
}