Chroma-Core 1.0.1

Easy to use APIs for plugin configuration, user data and commands (methods as commands)

  1. NorbiPeti
    Chroma-Core provides APIs to manage users, messages, exceptions and others, and has an easy to use command and a config system. It also comes with a component system to make the Chroma plugins more configurable. It also comes with a couple extra features.

    Features
    • The main command of this plugin is /chroma, although it doesn't have a lot in it. Do /chroma reload after changing the config.
    • You can enable/disable/list components (in any Chroma plugin) using the /component command.
    • There's an optional member component that adds a player to a certain permission group if they have been playing for long enough.
    • There are options for a scheduled restart, a delayed restart command with a countdown (/schrestart) and restarting when nobody is online (/primerestart).
    • There's a spawn component that can provide /spawn and works with BungeeCord
    • The plugin can rename Towny residents when a player changes their name, if that plugin is used
    • There is an optional random TP command that teleports the player to a random location within the worldborder
    • Chat channels are managed by this plugin, although they are only used to handle messages from other platforms (like Discord) as supporting Minecraft is Chroma-Chat's territory
    Setup
    I tried to make the plugin have reasonable defaults so hopefully all you need to do is give the
    Code (Text):
    chroma.mod
    permission to your moderator group, and enable any components you want to use (and set them up in the config if needed).

    API
    For more information about the API, see the Wiki on GitHub.

    Configuration
    Adding a configuration option (if you use the provided ButtonPlugin class instead of JavaPlugin or use the component system) is as simple as:
    Code (Java):
    public final ConfigData<String> someOption = getConfig().getData("someOption", "defaultValue");
    Then you can do someOption.get() and someOption.set() and all changes will be automatically saved. You can also use Javadoc comments to describe the config option and it will be added to the file by the bundled annotation processor.

    Commands
    Commands can be defined by creating methods in a class like this:
    Code (Text):

    @Subcommand
    public void subcmd(CommandSender sender, String someArg, int anotherArg) { ... }
     
    The parameter names are used to automatically create a usage text. Optional args, text args (that can have multiple words) can also be used. Full tabcomplete support is added for the subcommands and arguments (thanks to Commodore).

    User data
    User data can be accessed and saved using the configuration system as well, just use ChromaGamerBase.getUser("ID", SomeUserClass.class). User classes aren't just for Minecraft players, they can be anything (this is used to store Discord user data at the moment). User objects are cached and saved automatically.