Code Monkey home page Code Monkey logo

infinitylib's Introduction

InfinityLib

A shaded library for Slimefun addons which adds a bunch of useful classes and utilities.

Release

Packages & Features

Core

AbstractAddon: An implementation of JavaPlugin which you will need to extend for many of the other features to work. It provides multiple utility methods and does some basic setup for you.

AddonConfig: is an implementation of YamlConfiguration which makes comments available in the user's config and provides utility methods such as getting a value from within a range and removing unused/old keys from the user's config.

Common

CoolDowns: A utility object for keeping track of cool downs of players/uuids

PersistentType: Contains some PersistentDataTypes for ItemStack's, ItemStack Array's, Locations, and String Arrays. Also provides a constructor for PersistentDataType that uses lambda parameters.

Events: Contains static utility methods for registering listeners, creating handlers, and calling events

Scheduler: Contains static utility methods for running and repeating tasks

Commands

AddonCommand: allows you to add commands easily with a parent-child structure, so you could have a command with a sub command which has a sub command. It also adds some default commands such as an addon info, aliases, and help command.

Groups

MultiGroup: An implementation of ItemGroup which lets you organize your groups into SubGroups

SubGroup: An ItemGroup that is hidden from the main page, for use in MultiGroup

Machines

MenuBlock: A SlimefunItem with a menu, providing overridable methods for setting up the menu

TickingMenuBlock: A MenuBlock with slimefun ticker

AbstractMachineBlock: A TickingMenuBlock which implements EnergyNetComponent and provides a process method

MachineBlock: An AbstractMachineBlock which makes it easy to create simple input-output machines

Future Additions

Translation Utility: Some sort of easy way to create translatable strings for your addon's and infinitylibs's strings

InfinityLib Metrics: Metrics to see which versions or even classes are being used

How to use

First you need to add InfinityLib to the dependencies section in your pom.xml:

<dependency>
    <groupId>io.github.mooy1</groupId>
    <artifactId>InfinityLib</artifactId>
    <version>SPECIFY VERSION HERE</version>
    <scope>compile</scope>
</dependency>

Then you need to relocate it into your own package so that it doesn't conflict with other addon's classes.

Under the build section in your pom.xml, you should have the following:

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.4</version>
        <configuration>
            <!-- This will exclude any unused classes from libraries to reduce file size, not required -->
            <minimizeJar>true</minimizeJar>
            <relocations>
                <!-- This is the relocation, make sure to replace the package name, REQUIRED -->
                <relocation>
                    <pattern>io.github.mooy1.infinitylib</pattern>
                    <shadedPattern>YOUR.MAIN.PACKAGE.HERE.infinitylib</shadedPattern>
                </relocation>
            </relocations>
            <filters>
                <filter>
                    <artifact>*:*</artifact>
                    <excludes>
                        <exclude>META-INF/*</exclude>
                    </excludes>
                </filter>
            </filters>
        </configuration>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>shade</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
</plugins>

Then change your main plugin class to extend AbstractAddon and implement the constructor. You will need to use enable() and disable() instead of onEnable() and onDisable. Make sure you don't call super.onEnable/Disable. Your updater and config setup is now handled, make sure to test that it's working though!

infinitylib's People

Contributors

github-actions[bot] avatar mooy1 avatar seggan 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.