pixerena / firework

A progressive Minecraft plugin framework for managing event listener with ease and building reactive UI.

Home Page:https://javadoc.io/doc/io.github.pixerena/firework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Firework

GitHub Workflow Status (with event) Maven Central GitHub

A progressive Minecraft plugin framework for managing event listener with ease and building reactive UI.

Warning Firework framework is under active development and all the API are subject to changes before reaching v1. Use at your own risk.

Installation

Install firework with gradle

// build.gradle.kts

dependencies {
    implementation("io.github.pixerena:firework:0.6.0")
}
// build.gradle

dependencies {
    implementation "io.github.pixerena:firework:0.6.0"
}

Features

  • Dependency injection powered by Guice
  • Auto registered Bukkit event listeners
  • Create custom command
  • Server and plugin lifecycle hooks
  • Reactive utilities inspired by SolidJS
  • Minecraft UI components
    • Custom sidebar using scoreboard
    • Reactive and persistent action bar
    • And much more ...

Usage

package com.example.plugin;

import io.github.pixerena.firework.FireworkPlugin;

public class ExamplePlugin extends FireworkPlugin {
   public ExamplePlugin() {
       super("com.example.plugin");
   }
}

To get started with firework framework, just extend the FireworkPlugin class and provide your project's root package to super constructor.

Then add the class to the main section of plugin.yml.

name: ExamplePlugin
version: 1.0.0
main: com.example.plugin.ExamplePlugin
description: An example plugin
author: Pixerena
website: https://github.com/pixerena
api-version: '1.20'

Component

Component is the basic building block for the DI system. Every class marked with @Component annotation will be initialized as singleton and can be injected to another component's constructor.

import com.google.inject.Inject;
import io.github.pixerena.firework.inject.Component;

@Component
public class ExampleComponent {
   private final AnotherComponent anotherCompo;
   
   @Inject
   public ExampleComponent(AnotherComponent anotherCompo) {
     this.anotherComponent = anotherComponent;
   }
}

@Component
public class AnotherComponent {
  // ...
  @Inject
  public AnotherComponent() {
     // ...
  }
}

Event Listeners

Every event listeners should implement Listener interface and marked with @EventListener annotation. Inherently, @EventListener is also a component, so it can inject other components to its constructor.

import org.bukkit.event.Listener;
import org.bukkit.event.EventHandler;
import io.github.pixerena.firework.event.EventListener;

@EventListener
public class ExampleListener implements Listener {
   @EventHandler
   public void onPlayerJoin(PlayerJoinEvent event) {
        // ...
   }
}

Documentation

License

Apache License 2.0

About

A progressive Minecraft plugin framework for managing event listener with ease and building reactive UI.

https://javadoc.io/doc/io.github.pixerena/firework

License:Apache License 2.0


Languages

Language:Java 92.3%Language:Kotlin 7.7%