SkytAsul / Lamp

A powerful, extendable, flexible yet simple to use commands annotation framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lamp

Discord License: MIT Build

Background

Click to expand Building commands has always been a core concept in many applications, and, lots of times, a really boring and cumbersome one to pull off: Having to think of all the possible input from the user, all the mistakes they will make, validating input and then finally executing the actual command logic.

We aren't supposed to mess our hands up with so much of this. We really shouldn't get ourselves dirty with the highly error-prone string manipulation, nor are we supposed to repeat 3 lines of code a thousand times. We also should not be forced to think of all the edge cases and possible output of the user side. Developers should focus on what's important, not what isn't.

Then after all that, we really should make sure our code is clean, maintainable, extendable and flexible.

Building upon this belief, Lamp was born.

Lamp has taken responsibility upon itself to take all the crap of the command creation process: parsing input, validating arguments, auto completions, tokenizing and redirection, and leaves you only to the important part of your job here: the actual command logic.

Through annotations, parameter resolvers, command conditions, permissions, argument validators, cooldowns, dependency injection, auto-completers, Lamp not only makes the command creation process much easier, it also becomes more fun, intuitive and less error prone.

There are many commands frameworks out there, why should I use Lamp?

Glad you asked!

Getting Started

Now, for the good part.

First, you'll need to add the JitPack repository, and then you're going to select which part of Lamp you're going to use.

If you for some reason want to use the whole project as dependency, you can use "com.github.Revxrsal" as the groupId (or group on Gradle), and only the name "Lamp" as the artifactId (or name on Gradle). But if you chose to use only one module or two, you have to use "com.github.Revxrsal.Lamp" as the groupId and "[the module that you want]" as the artifactId. Bellow, there are examples about Maven and Gradle that will help you get started.

Maven

pom.xml
<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <!-- For the common module -->
    <dependency>
        <groupId>com.github.Revxrsal.Lamp</groupId>
        <artifactId>common</artifactId> 
        <version>[version]</version>
    </dependency>

    <!-- For the bukkit module -->
    <dependency>
        <groupId>com.github.Revxrsal.Lamp</groupId>
        <artifactId>bukkit</artifactId>
        <version>[version]</version>
    </dependency>  
</dependencies>

Gradle

build.gradle (Groovy)
repositories {
    maven { url = 'https://jitpack.io' }
}

dependencies {
    // For the common module
    implementation 'com.github.Revxrsal.Lamp:common:[version]'

    // For the bukkit module
    implementation 'com.github.Revxrsal.Lamp:bukkit:[verison]'
}

compileJava { // Preserve parameter names in the bytecode
    options.compilerArgs += ["-parameters"]
    options.fork = true
    options.forkOptions.executable = "javac"
}

compileKotlin { // optional: if you're using Kotlin
    kotlinOptions.javaParameters = true
}
build.gradle.kts (Kotlin DSL)
repositories {
    maven(url = "https://jitpack.io")
}

dependencies {
    // For the common project
    implementation("com.github.Revxrsal.Lamp:common:[version]")

    // For the bukkit module
    implementation("com.github.Revxrsal.Lamp:bukkit:[verison]")
}

compileJava { // Preserve parameter names in the bytecode
    options.compilerArgs += ["-parameters"]
    options.fork = true
    options.forkOptions.executable = "javac"
}

compileKotlin { // optional: if you're using Kotlin
    kotlinOptions.javaParameters = true
}

Documentation

About

A powerful, extendable, flexible yet simple to use commands annotation framework.

License:MIT License


Languages

Language:Java 97.2%Language:Kotlin 2.8%