Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dev.kotx:flylib-reloaded

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dev.kotx:flylib-reloaded

An utility library for Minecraft Paper that provides commands, menus, Kotlin extensions, and more.

  • 0.5.0
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

Logo

FlyLib Reloaded

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

⚡ 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 entrypoint. Must place in onEnable or Plugin Constructor
        flyLib {
            command(ExplodeCommand())
            listen(BlockBreakEvent::class.java) { event ->
                //block break event logic
            }
        }
    }
}

/**
 * /explode <targets (players)> <power (integer)> <mode (one or two)>
 */
class ExplodeCommand : Command("explode") {
    init {
        usage {
            //add typed arguments
            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() {
        //FlyLib entrypoint. Must place in onEnable or Plugin Constructor
        FlyLibKt.flyLib(this, flyLib -> {
            flyLib.command(new ExplodeCommand());
            flyLib.listen(BlockBreakEvent.class, event -> {
                //block break event logic
            });
        });
    }
}

/**
 * /explode <targets (players)> <power (integer)> <mode (one or two)>
 */
class ExplodeCommand extends Command {
    public ExplodeCommand() {
        super("explode");

        usage(usage -> {
            //add typed arguments
            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

//some gradle configurations

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>

FAQs

Package last updated on 17 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc