Git Product home page Git Product logo

lamp's Introduction

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

lamp's People

Contributors

revxrsal avatar skytasul avatar dhugo0022 avatar tehneon avatar growlyx avatar tofpu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.