|
| 1 | +## Core |
| 2 | +<b>AbstractAddon</b>: An implementation of JavaPlugin |
| 3 | +which you will need to extend for many of the other features to work. |
| 4 | +It provides multiple utility methods and does some basic setup for you. |
| 5 | + |
| 6 | +<b>AddonConfig</b>: is an implementation of YamlConfiguration |
| 7 | +which makes comments available in the user's config |
| 8 | +and provides utility methods such as getting a value from within a range |
| 9 | +and removing unused/old keys from the user's config. |
| 10 | + |
| 11 | +## Common |
| 12 | +<b>CoolDowns</b>: A utility object for keeping track of cool downs of players/uuids |
| 13 | + |
| 14 | +<b>PersistentType</b>: Contains some PersistentDataTypes for |
| 15 | +ItemStack's, ItemStack Array's, Locations, and String Arrays. |
| 16 | +Also provides a constructor for PersistentDataType that uses lambda parameters. |
| 17 | + |
| 18 | +<b>Events</b>: Contains static utility methods for registering listeners, creating handlers, and calling events |
| 19 | + |
| 20 | +<b>Scheduler</b>: Contains static utility methods for running and repeating tasks |
| 21 | + |
| 22 | +## Commands |
| 23 | +<b>AddonCommand</b>: allows you to add commands easily with a parent-child structure, |
| 24 | +so you could have a command with a sub command which has a sub command. |
| 25 | +It also adds some default commands such as an addon info, aliases, and help command. |
| 26 | + |
| 27 | +## Groups |
| 28 | +<b>MultiGroup</b>: An implementation of ItemGroup which lets you organize your groups into SubGroups |
| 29 | + |
| 30 | +<b>SubGroup</b>: An ItemGroup that is hidden from the main page, for use in MultiGroup |
| 31 | + |
| 32 | +## Machines |
| 33 | +<b>MenuBlock</b>: A SlimefunItem with a menu, providing overridable methods for setting up the menu |
| 34 | + |
| 35 | +<b>TickingMenuBlock</b>: A MenuBlock with slimefun ticker |
| 36 | + |
| 37 | +<b>AbstractMachineBlock</b>: A TickingMenuBlock which implements EnergyNetComponent and provides a process method |
| 38 | + |
| 39 | +<b>MachineBlock</b>: An AbstractMachineBlock which makes it easy to create simple input-output machines |
| 40 | + |
| 41 | +## Future Additions |
| 42 | +<b>Translation Utility</b>: Some sort of easy way to create translatable strings for your addon's and infinitylibs's strings |
| 43 | + |
| 44 | +<b>InfinityLib Metrics</b>: Metrics to see which versions or even classes are being used |
| 45 | + |
| 46 | +# How to use |
| 47 | + |
| 48 | +First you need to add InfinityLib to the `dependencies` section in your `pom.xml`: |
| 49 | + |
| 50 | +```xml |
| 51 | +<dependency> |
| 52 | + <groupId>io.github.mooy1</groupId> |
| 53 | + <artifactId>InfinityLib</artifactId> |
| 54 | + <version>SPECIFY VERSION HERE</version> |
| 55 | + <scope>compile</scope> |
| 56 | +</dependency> |
| 57 | +``` |
| 58 | + |
| 59 | +Then you need to relocate it into your own package so that it doesn't conflict with other addon's classes. |
| 60 | + |
| 61 | +Under the `build` section in your `pom.xml`, you should have the following: |
| 62 | + |
| 63 | +```xml |
| 64 | +<plugins> |
| 65 | + <plugin> |
| 66 | + <groupId>org.apache.maven.plugins</groupId> |
| 67 | + <artifactId>maven-shade-plugin</artifactId> |
| 68 | + <version>3.2.4</version> |
| 69 | + <configuration> |
| 70 | + <!-- This will exclude any unused classes from libraries to reduce file size, not required --> |
| 71 | + <minimizeJar>true</minimizeJar> |
| 72 | + <relocations> |
| 73 | + <!-- This is the relocation, make sure to replace the package name, REQUIRED --> |
| 74 | + <relocation> |
| 75 | + <pattern>io.github.mooy1.infinitylib</pattern> |
| 76 | + <shadedPattern>YOUR.MAIN.PACKAGE.HERE.infinitylib</shadedPattern> |
| 77 | + </relocation> |
| 78 | + </relocations> |
| 79 | + <filters> |
| 80 | + <filter> |
| 81 | + <artifact>*:*</artifact> |
| 82 | + <excludes> |
| 83 | + <exclude>META-INF/*</exclude> |
| 84 | + </excludes> |
| 85 | + </filter> |
| 86 | + </filters> |
| 87 | + </configuration> |
| 88 | + <executions> |
| 89 | + <execution> |
| 90 | + <phase>package</phase> |
| 91 | + <goals> |
| 92 | + <goal>shade</goal> |
| 93 | + </goals> |
| 94 | + </execution> |
| 95 | + </executions> |
| 96 | + </plugin> |
| 97 | +</plugins> |
| 98 | +``` |
| 99 | + |
| 100 | +Then change your main plugin class to extend `AbstractAddon` and implement the constructor. |
| 101 | +You will need to use `enable()` and `disable()` instead of `onEnable()` and `onDisable`. |
| 102 | +Make sure you don't call `super.onEnable/Disable`. |
| 103 | +Your updater and config setup is now handled, make sure to test that it's working though! |
0 commit comments