项目作者: memecatFatCat

项目描述 :
A library with many utilities that help with developing Bukkit or Spigot plugins.
高级语言: Java
项目地址: git://github.com/memecatFatCat/plugin-utilities.git
创建时间: 2019-08-07T10:16:05Z
项目社区:https://github.com/memecatFatCat/plugin-utilities

开源协议:MIT License

下载


plugin-utilities

Java
License

Overview

An optimized and lightweight toolkit of flexible common utilities for developing Spigot API plugins.

Features

  • menu package for easily making custom flexible menus with clickable ItemStacks managed in the background through Spigot events,
  • ItemBuilder for less headache with ItemMeta and ItemStack modifications,
  • cooldowns package for tracking and renewing of expirable durations,
  • plugin file package with methods for managing multiple or custom configuration files

Installation

  1. Add the library as a JitPack dependency via a build automation tool that you’re using, such as Maven, Gradle, sbt,
    etc. See all releases, snapshots and guides at
    the official JitPack website of this project.

  2. Shade the dependency library using JAR minimization to exclude unused features from being compiled with your plugin,
    which will decrease the file size impact of the dependency while keeping your plugin lightweight. Even though the
    dependency is small, this process ensures efficient packaging by eliminating unnecessary code.

    Here’s how you can configure it using Maven Shade Plugin, by adding inside Maven <plugins>...</plugins>:

    1. <plugin>
    2. <groupId>org.apache.maven.plugins</groupId>
    3. <artifactId>maven-shade-plugin</artifactId>
    4. <version>VERSION</version> <!-- Replace VERSION with the latest plugin version -->
    5. <executions>
    6. <execution>
    7. <phase>package</phase>
    8. <goals>
    9. <goal>shade</goal>
    10. </goals>
    11. <configuration>
    12. <minimizeJar>true</minimizeJar>
    13. <artifactSet>
    14. <!-- Replace the "Tag" with the latest release version -->
    15. <includes>com.github.CosimoTiger:plugin-utilities:Tag</includes>
    16. </artifactSet>
    17. </configuration>
    18. </execution>
    19. </executions>
    20. </plugin>

    Here’s how you can configure it using the Gradle Shadow plugin (Groovy):

    1. plugins {
    2. id 'java'
    3. // Replace the "VERSION" with the latest release available at https://github.com/GradleUp/shadow
    4. id 'com.gradleup.shadow' version 'VERSION'
    5. }
    6. shadowJar {
    7. archiveClassifier.set('all')
    8. manifest {
    9. attributes 'Main-Class': 'path.to.your.PluginMain'
    10. }
    11. dependencies {
    12. // Replace the "Tag" with the latest release version
    13. include dependency('com.github.CosimoTiger:plugin-utilities:Tag')
    14. }
    15. }
  3. Start writing your code. Here’s the typical plugin initialization code example:

    1. import com.cosimo.utilities.file.YamlFile;
    2. import com.cosimo.utilities.menu.manager.MenuManager;
    3. import org.bukkit.plugin.java.JavaPlugin;
    4. public class ExamplePlugin extends JavaPlugin {
    5. @Override
    6. public void onEnable() {
    7. MenuManager.setInstance(new MenuManager(this));
    8. final var config = new YamlFile(this, "command-config.yml").reloadFile().getMemory();
    9. getCommand("example").setExecutor(new ExampleCommand(config.getConfigurationSection("commands.example")));
    10. }
    11. }

Contributing

We welcome contributions from the community, through forking or opening an issue. They should be in line with the
project’s main goals: optimized code that benefits everyone.

License

This project is licensed under the MIT License.

Support

For questions, issues or feature requests, please use the
GitHub Issues section.