Git Product home page Git Product logo

wolfyutils-spigot's Introduction

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.

This is the Spigot implementation of WolfyUtils. For more info see WolfyScript/WolfyUtilities

APIs & Utils

  • API is plugin dependent, which means there is one instance of the API per plugin.
  • Utils are plugin independent. They can be used everywhere.
  • Registry is bound to the core of WolfyUtilities, but can be accessed from anywhere.

APIs

  • Inventory - Functional API to create in-game GUIs.
  • Language - Load JSON based language files and support multiple languages for GUIs, messages, etc.
  • Chat - Send translatable messages, text click event callbacks, and more.
  • Config - Simple config utilities.
  • NMS - Fully featured NBTTag API, custom RecipeIterator, and some block and Inventory Utils.
  • CustomItems - Create flexible custom items with settings like custom fuel, durability, actions, etc.

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:

  • NamespacedKey - Unique key for all registrable content.
  • JSON - Various Jackson utils that simplify de-/serialization
    • Custom de-/serializer for Bukkit objects
    • Easy de-/serialization from Registry values
      • Object (See @OptionalKeyReference)
      • Type to object (See @KeyedTypeIdResolver & @KeyedTypeResolver)
  • Particles - Configure custom particle effects & animations using JSON.
  • RandomCollection - Weight based random collection.
  • Reflection - Basic Reflection Utils.
  • Player Head utils to set textures and more.
  • Basic MySQL connection to run queries and updates.
  • ItemBuilder to edit/create ItemStacks.
  • Save player specific data.

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.

wolfyutils-spigot's People

Contributors

wolfyscript avatar beepowuff avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.