Quick Start

Install the library

This is the ways to access the API:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
<dependency>
    <groupId>com.github.broken1arrow.Utility-Library</groupId>
    <artifactId>Utility-Library</artifactId>
    <version>0.51</version>
    <scope>provided</scope>
</dependency>
</dependencies>

How to use the library

This guide provides suggestions on how to load the different modules of the library into your project. Please note that there are minor differences if you plan to use the menu library and only want to depend on this library and the Utility Library plugin. For more details, refer to the following instructions below.

Short Step-by-Step description how to use the library

Step 1: Adding the Library Dependency: To begin using the library, you must add the different modules you want to use in your project. Include the library as a dependency in your pom or Gradle file. Make sure to specify the correct version of the library and compile the modules with your project. If you intend to only provide the modules and want to use the API plugin jar only, proceed to step 3.

Step 2:After import the Necessary Modules: Don't forget to shade when you compile the project or you risk to encounter errors if the end user use different plugins that use same library. Ignore this step if you only plan to only provide the modules.

Step 3: Use the Utility Library plugin (Optional): If you intend to use the plugin jar and have access to all modules without need to shade, follow these additional steps:

  1. Install the Utility Library plugin jar in the same location as your project jar or in a directory where you load your dependencies. For Minecraft plugins, place it in the plugins folder alongside your plugin.

  2. Add the Utility-Library module to your project's pom or Gradle file.

Step 4: Utilize the Library Functionalities With the library integrated into your project and the essential modules imported, you can now begin utilizing the functionalities provided by the library. Refer to this documentation or Javadoc for detailed instructions on how to use specific features.

Classes you load ones.

These classes are designed to be instantiated only once in your code. It is recommended to create a single instance of each class.

A class used for registering and utilizing the menu API. This class provides various methods that can be accessed from the library, especially if you have added the ItemCreator and NBT module to the dependency's. Refer to Menu api for more information.

RegisterMenuAPI menuAPI = new RegisterMenuAPI(plugin);

CommandRegister

A class used for registering commands. This class is responsible for caching your commands and ensuring thread safety when modifying the cache. It offers methods for registering and removing subcommands, as well as registering the main command. Refer to Command for more information.

CommandRegister commandRegistering = new CommandRegister()

ItemCreator

A class used for creating items. This class adds support for both old and new naming conventions of items. You can use the 1.13+ item names, and if you are running an older version, it will automatically convert them to the old naming format as long as the item exists in that version. Refer to ItemCreator for more information.

ItemCreator itemCreator = new ItemCreator(plugin);

Classes you extend.

These are classes that you can directly extend and use in your code. They provide reusable functionality and are not limited to a single instance.

SimplePrompt

A class that extends the SimplePrompt class. It is used to create prompts and write the code that will be executed. Refer to Conversation for more information.

public class ExampleSimplePrompt extends SimplePrompt{}

SimpleConversation

A class that extends the SimpleConversation class. It is used for players to type in chat what they want the code to do. For example,you can use it for naming items or changing their player name. Refer to Conversation for more information.

public class ExampleSimpleConversation extends SimpleConversation{}

CommandHolder

A class that extends the CommandHolder class. This extension is used to create subcommands for your plugin, which can then be registered. Refer to Command for more information.

public class ExampleCommand extends CommandHolder{}

A class that extends the MenuHolder class. It is used to create simple menus and also supports filling items. Instead of setting the type of class for the objects in your list, you use objects directly. Refer to Menu api for more information.

public class Menu extends MenuHolder {}

GenericMenuHolder

A class that extends the GenericMenuHolder<T> class. It allows you to set the type you have in your list, and otherwise works the same as the MenuHolder class. Refer to Menu api for more information.

public class GenericMenu extends GenericMenuHolder<T> {}

YamlFileManager

A class that extends the YamlFileManager class. It aids in creating files easily, loading settings or data, saving files, and updating data without removing comments. Refer to Yaml Utility for more information.

public class Settings extends YamlFileManager {}

Classes you implement

This library provides several classes that you can implement based on your specific requirements.

ConfigurationSerializable

The ConfigurationSerializable interface, allowing easy serialization and deserialization of configuration data. Refer to Configuration Serialization for more information.

public class SettingsData implements ConfigurationSerializable {}

ParticleEffectAccessor

The ParticleEffectAccessor interface, providing utility methods for managing particle effects. Refer to Particles for more information.

public class ParticleClass implements ParticleEffectAccessor {}

Last updated