WolfyScript / WolfyUtils-Spigot

The WolfyUtilities implementation for the Spigot platform
10 stars 4 forks source link
WolfyUtilities Banner

WolfyUtils-Spigot

bstats_server
spigot_down spigot_stars
github_commit

Core API that provides an API and Utils for plugins based on Spigot.

[!NOTE]
WolfyUtils is still maintained, but it will be replaced by the more modern scafall project in the future!
While scafall is in development this project will still receive bug fixes and Minecraft compatibility updates.
Major feature updates should not be expected! New features will be implemented in scafall instead!
There is no ETA for scafall! Since scafall is still in alpha, it will be a while till it's stable!

APIs & Utils

APIs

Registry

The Registry is the base of all custom content in WolfyUtilities and the plugins that build on it. It allows you to register types & objects under unique namespaced keys. That not only allows the plugin to register things like CustomItems, etc., but it can be extended by other plugins too.

Utils:

Plugins using WolfyUtilities

CustomCrafting

CustomCrafting is heavily based on these APIs and Utils, and is more of an extension than standalone plugin.
CustomCrafting especially makes use of the InventoryAPI to create and manage the in-game RecipeCreators. The JSON utils are used to load/save recipes & items from/to JSON, and to allow for custom settings inside the json files.

Getting started

You can get the API from the public maven repo:

<repositories>
    <repository>
        <id>wolfyscript-public</id>
        <url>https://maven.wolfyscript.com/repository/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.wolfyscript.wolfyutilities</groupId>
        <artifactId>wolfyutilities</artifactId>
        <version>3.16.1.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

To start using it you need to create an API instance for your plugin.
It's best to initiate it in your constructor, so you don't mistakenly change the instance of the api. (And we are able to use some options of the API onLoad())


import me.wolfyscript.lib.net.kyori.adventure.text.Component;

public class YourPlugin extends JavaPlugin {

  private final WolfyUtilities api;

  public YourPlugin() {
    super();
    //Create the instance for your plugin. We don't want to initialize the events yet (so set it to false)!
    api = WolfyUtilCore.getInstance().getAPI(this, false);
    this.chat = api.getChat();
    //We should set our prefix for the chat
    this.chat.setChatPrefix(Component.text("[", NamedTextColor.GRAY).append(Component.text("CC", NamedTextColor.AQUA))
            .append(Component.text("] ", NamedTextColor.DARK_GRAY)));
    //Or using the MiniMessage api
    this.chat.setChatPrefix(chat.getMiniMessage().parse("<gray>[<gradient:dark_aqua:aqua>CC</gradient><gray>]"));

    //Optionally you can set a custom cache object to cache data for your GUI.
    api.setInventoryAPI(new InventoryAPI<>(api.getPlugin(), api, CCCache.class));
  }

  @Override
  public void onEnable() {
    //Once the plugin is enabled we can initialize the events!
    this.api.initialize();
  }

}

More info about the API can be found in the Wiki.