FlyLib Reloaded is a utility library for Minecraft Paper that provides commands, menus, Kotlin extensions, and more.
⚠️This library is currently under development (beta version is 0.*.*
), and the API will be changed or removed
without notice.
🔥 Features
- Powerful command engine
- DSL Menu builder
- Event flow manager like RxJava
- Many useful Extensions, Utilities, Builders for Bukkit
- Easy to set up & use
📎 Links
⚡ Quickstart
You can implement tab completion, type checking, help message generation, and subcommands with the following simple code
without writing plugin.yml.
Kotlin:
class TestPlugin : JavaPlugin() {
init {
flyLib {
command(ExplodeCommand())
listen(BlockBreakEvent::class.java) { event ->
}
}
}
}
class ExplodeCommand : Command("explode") {
init {
usage {
entityArgument("targets")
integerArgument("power", min = 1, max = 10)
selectionArgument("mode", "one", "two")
executes {
message("You executed explode command!")
}
}
}
}
Java:
public class TestPlugin extends JavaPlugin {
@Override
public void onEnable() {
FlyLibKt.flyLib(this, flyLib -> {
flyLib.command(new ExplodeCommand());
flyLib.listen(BlockBreakEvent.class, event -> {
});
});
}
}
class ExplodeCommand extends Command {
public ExplodeCommand() {
super("explode");
usage(usage -> {
usage.entityArgument("targets");
usage.integerArgument("power", 1, 10);
usage.selectionArgument("mode", "one", "two");
usage.executes(context -> context.message("You executed explode command!"));
});
}
}
⚙️ Installation
Replace [version]
with the version you want to use.
Gradle Kotlin DSL
Please add the following configs to your build.gradle.kts
.
Use the shadowJar
task when building plugins (generating jars to put in plugins/).
plugins {
id("com.github.johnrengelman.shadow") version "6.0.0"
}
dependencies {
implementation("dev.kotx:flylib-reloaded:[version]")
}
The following code is a configuration of shadowJar that combines all dependencies into one jar.
It relocates all classes under the project's groupId to avoid conflicts that can occur when multiple plugins using
different versions of flylib are deployed to the server.
By setting the following, the contents of the jar file will look like this
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
val relocateShadow by tasks.registering(ConfigureShadowRelocation::class) {
target = tasks.shadowJar.get()
prefix = project.group.toString()
}
tasks.shadowJar {
dependsOn(relocateShadow)
}
Gradle
plugins {
id 'com.github.johnrengelman.shadow' version '6.0.0'
}
dependencies {
implementation 'dev.kotx:flylib-reloaded:[version]'
}
The following code is a configuration of shadowJar that combines all dependencies into one jar.
It relocates all classes under the project's groupId to avoid conflicts that can occur when multiple plugins using
different versions of flylib are deployed to the server.
By setting the following, the contents of the jar file will look like this
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
//some gradle configurations
task relocateShadow(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = project.group
}
tasks.shadowJar.dependsOn tasks.relocateShadow
Maven
Add the following dependencies and add them to the jar file with maven-shade-plugin
etc. when building the plugin.
<dependency>
<group>dev.kotx</group>
<name>flylib-reloaded</name>
<version>[version]</version>
</dependency>