GithubHelp home page GithubHelp logo

yolosanta / commands Goto Github PK

View Code? Open in Web Editor NEW

This project forked from blazingtide/commands

0.0 0.0 0.0 140 KB

The command library made for all Java-based applications but, is primarily used for the Spigot and Bungeecord libraries.

Java 97.16% Kotlin 2.84%

commands's Introduction

Commands GitHub Actions status | BlazingTide/Commands

The command library made for all Java-based applications.

Features

  • Annotation based command creation
  • Automatic mapping of arguments
  • Optional arguments with null support
  • Auto complete / Tab complete for each type
  • Auto Complete for individual arguments (@AutoComplete)
  • Permissions for individual arguments
  • No plugin.yml command registration required
  • Automatic help message generation
  • Async & Sync at the command declaration level
  • String Concatenation for last parameter
  • Spigot Support
  • Velocity Support
  • & more!

Installation

You can download the library in releases or build it yourself. To use the library inside a plugin, add this to your pom.xml.

<!-- Spigot -->
<dependencies>
    <dependency>
        <groupId>me.blazingtide.commands</groupId>
        <artifactId>spigot</artifactId>
        <version>1.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

        <!-- Velocity -->
<dependencies>
<dependency>
    <groupId>me.blazingtide.commands</groupId>
    <artifactId>velocity</artifactId>
    <version>1.0</version>
    <scope>provided</scope>
</dependency>
</dependencies>

Modules

api - The main api for the project
spigot - The spigot module for the project
kotlin - A module for easy creation of commands via Kotlin
velocity - The velocity module for the project

How to use (Standalone API)

Upload the spigot or velocity plugin on your server. It's that simple! You can begin using the library right away.

Annotation Example

After multiple requests, this library now supports annotations. You can take advantage of this robust framework using annotations similar to other popular command frameworks.

Below is an example of the same command built using annotations.

// /item give example
@Command(labels = {"item give"}, permission = "command.give", usage = "<item> <player>")
public void execute(CommandSender sender,Material material,@PermissionParam("command.give.other") @OptionalParam Player target){
        //Adding @OptionalParam on the last parameter allows that parameter to be nullable
        //Adding @PermissionParam will require the sender to have that permission to use that parameter    

        if(target==null){
        if(!(sender instanceof Player)){
        sender.sendMessage("You must be a player to perform this command!");
        return;
        }

final Player player=(Player)sender;

        player.getInventory().addItem(new ItemStack(material));
        sender.sendMessage("You have received "+material);
        return;
        }

        target.getInventory().addItem(new ItemStack(material));
        target.sendMessage("You have received "+material);
        }

Register Command

Commands.registerAnnotations(new YourCommand());

The library will register your command and handle everything else.

commands's People

Contributors

blazingtide 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.