Giter Site home page Giter Site logo

commandapi's Introduction

CommandAPI

Présentation

➠ Développeur(s) : BakaAless

➠ État : Fini

Description

➠ API permettant de faciliter la création de commandes avec un plugin. Le système utilise des annotations afin de créer des commandes et sous-commandes.

➠ Créer une commande facilement :

import fr.bakaaless.api.command.CommandRunner;
import fr.bakaaless.api.command.annotations.RunCommand;
import org.bukkit.command.CommandSender;

import java.util.Collections;

@RunCommand(command = "maNouvelleCommande")
public class MaSuperbeCommande implements CommandRunner {

    @Override
    public boolean run(final CommandSender sender, final List<String> args) {
        sender.sendMessage("Salut, t'as l'air trop cool :)");
        return true;
    }

    @Override
    public List<String> tabCompleter(final CommandSender sender, final List<String> args) {
        return Collections.singletonList("secret");
    }
}

➠ Créer une sous-commande simplement via une classe :

import fr.bakaaless.api.command.CommandRunner;
import fr.bakaaless.api.command.annotations.RunCommand;
import org.bukkit.command.CommandSender;

import java.util.ArrayList;

@RunSubCommand(command = "maNouvelleCommande", subCommand = {"secret", "mystère"})
public class MaSuperbeSousCommande implements CommandRunner {

    @Override
    public boolean run(final CommandSender sender, final List<String> args) {
        sender.sendMessage("Bien joué tu as trouvé la commande secrète ;)");
        return true;
    }

    @Override
    public List<String> tabCompleter(final CommandSender sender, final List<String> args) {
        return new ArrayList<>();
    }
}

➠ Créer un manager de commandes et enregistrer des classes :

import fr.bakaaless.api.command.CommandManager;
import org.bukkit.plugin.JavaPlugin;

public class Main extends JavaPlugin {
 
    private CommandManager commandManager;
    
    @Override
    public void onEnable() {
        this.manager = new CommandManager(this);
        this.manager.registerRunners(MaSuperbeCommande.class, MaSuperbeSousCommande.class);
    }
}

Intégration

Release

➠ Pour intégrer ce code à gradle, en remplaçant Version par la version ci-dessus :

repositories {
  maven { url 'https://jitpack.io' }
}

dependencies {
  implementation group: 'com.github.BakaAless', name: 'CommandAPI', version: 'VERSION'
}

Licence

CommandAPI is under GPL-3.0 License.

commandapi's People

Contributors

alessevan avatar

Watchers

 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.