All Projects → Paul2708 → simple-commands

Paul2708 / simple-commands

Licence: MIT license
An (even more) simplified and intuitive command framework for Spigot.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to simple-commands

CommandWhitelist
You decide what commands players can use or tab complete on your server!
Stars: ✭ 115 (+721.43%)
Mutual labels:  spigot, commands
chronosjs
JS Channels (Events / Commands / Reqest-Response / Courier) Mechanism
Stars: ✭ 35 (+150%)
Mutual labels:  commands
simple-jwt-provider
No description or website provided.
Stars: ✭ 33 (+135.71%)
Mutual labels:  simple
Yolo-to-COCO-format-converter
Yolo to COCO annotation format converter
Stars: ✭ 176 (+1157.14%)
Mutual labels:  annotations
SkyChanger
Change the color of your personal sky in Minecraft ⛅️⚡️🌄
Stars: ✭ 31 (+121.43%)
Mutual labels:  spigot
controller-logger
AOP based API logging for Spring Boot
Stars: ✭ 57 (+307.14%)
Mutual labels:  annotations
Easythread
一款安全、轻巧、简单的线程池管理器
Stars: ✭ 250 (+1685.71%)
Mutual labels:  simple
AdvancedCore
Core API for my plugins on SpigotMC
Stars: ✭ 54 (+285.71%)
Mutual labels:  spigot
advancedSmsManager
Advanced SmsManager is avery handy library for sending sms for single and two sim-card phones with many options.
Stars: ✭ 27 (+92.86%)
Mutual labels:  simple
TileCulling
Hides tiles that players are not able to see due to blocks in the way, preventing cheaters from seeing chests behind walls.
Stars: ✭ 31 (+121.43%)
Mutual labels:  spigot
spartana
A grafana clone that does the bare minimum. SRE's dream dashboarding solution
Stars: ✭ 37 (+164.29%)
Mutual labels:  simple
mc-server-wrapper
Lightweight Minecraft server wrapper binary for Discord chat bridge + enhanced management tools
Stars: ✭ 17 (+21.43%)
Mutual labels:  spigot
jcli
A CLI framework for D
Stars: ✭ 21 (+50%)
Mutual labels:  commands
stylelint-problem-matcher
A GitHub Action that registers a problem matcher for Stylelint's report format
Stars: ✭ 18 (+28.57%)
Mutual labels:  annotations
scaffold
WIP - Simplified PHP framework, using modern practices and techniques. Making use of the best components available.
Stars: ✭ 56 (+300%)
Mutual labels:  simple
ngx-ion-simple-mask
Input mask for Angular/Ionic
Stars: ✭ 21 (+50%)
Mutual labels:  simple
Skript-1.8
The Skript plugin made for Minecraft 1.8.x only. Releases will follow the original repository, except for some bug fixes. Please read the README before updating to Skript-1.8 !
Stars: ✭ 38 (+171.43%)
Mutual labels:  spigot
react-click-to-edit
Make any text editable.
Stars: ✭ 16 (+14.29%)
Mutual labels:  simple
Minefana
Bungee/Spigot plugin to send stats to a InfluxDB to be displayed by a Grafana instance.
Stars: ✭ 23 (+64.29%)
Mutual labels:  spigot
httpfs
Go 编写的静态文件服务器,支持文件拖拽上传,无第三方包依赖, 支持 Windows, Linux , Darwin。
Stars: ✭ 28 (+100%)
Mutual labels:  simple

simple-commands actions

Simple commands is a command framework for Spigot. It's currently under heavy development, so stay tuned.

Note: This project is inspired by Aikar. So checkout the other command framework, if you find this project interesting.

Why is it called "simple"?

Spigot features its own command framework by using the command design pattern.

It's quite simple to create own commands. But if you have multiple commands with even more sub commands, there will be a lot of redundant and duplicated code.

The intention behind the framework is to handle and check the arguments, so that the implementation of the command only features the actual logic. This will be achieved by using annotations and interfaces for command arguments.

Current supported features

  • basic set of command arguments (primitive data types, enums)
  • custom command arguments
  • declaring a command by annotation and its arguments
  • register commands without editing plugin.yml
  • dependency injection via @Inject
  • custom messages by using language files

Installation

Maven

Just add the following repository and dependency to your Maven project.

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.github.Paul2708</groupId>
    <artifactId>simple-commands</artifactId>
    <version>0.4.1</version>
</dependency>

Jar

If you don't use a build tool like Maven or Gradle, you can download the latest release here.

Local build

  1. Clone the repository git clone https://github.com/Paul2708/simple-commands.git
  2. Install it into your local maven repo by mvn clean install
  3. Add the following dependency to your project
<dependency>
    <groupId>de.paul2708</groupId>
    <artifactId>simple-commands-core</artifactId>
    <version>0.4.1</version>
</dependency>

Getting started

Sample command

The following code snippet represents a simple teleport command.

@Command(name = "teleport", desc = "Teleport you to a player", permission = "example.tp")
public void test(Player sender, Player target) {
    condition(!sender.equals(target), "You cannot teleport you to yourself");

    sender.teleport(target);
    sender.sendMessage("You got teleported to " + target.getName() + ".");
}

An example plugin with all current features like language selection and dependency injection can be found here. It's really recommended as it is a real working plugin with features implemented.

Some wiki pages will follow soon.

Comparison: Spigot command vs. simple command

The following commands teleport a target player to a given y-height.

Spigot command

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (sender instanceof ConsoleCommandSender) {
        sender.sendMessage("This command is for players only.");
        return false;
    }
    if (!sender.hasPermission("example.tp")) {
        sender.sendMessage("You do not have enough permissions.");
        return false;
    }
    if (args.length != 2) {
        sender.sendMessage("False usage. Please use 3 parameters instead of " + args.length);
        return false;
    }

    Player player = Bukkit.getPlayer(args[0]);
    if (player == null || !player.isOnline()) {
        sender.sendMessage("The player is not online.");
        return false;
    }

    int yHeight;

    try {
        yHeight = Integer.parseInt(args[1]);
    } catch (NumberFormatException e) {
        sender.sendMessage("This argument is not a number.");
        return false;
    }

    if (yHeight <= 0) {
        sender.sendMessage("The height has to be positive.");
        return false;
    }

    // Finally done...
    Location location = player.getLocation().clone();
    location.setY(yHeight);
    player.teleport(location);

    sender.sendMessage("You teleported " + player.getName() + " to " + yHeight);
    return true;
}

Simple command

@Command(name = "teleport", desc = "Teleport a player to y", permission = "example.tp")
public void test(Player sender, Player target, int yHeight) {
    condition(yHeight > 0, "The height has to be positive.");

    Location location = target.getLocation().clone();
    location.setY(yHeight);
    target.teleport(location);

    sender.sendMessage("You teleported " + target.getName() + " to " + yHeight);
}

I think, you can spot the differences and the boilerplate by spigot.

Contribution

Here is a set of instructions that will guide you through your contribution.

Contact

If you find any issues, please let me know! Just open a bug report or another issue.

Paul2708 - Twitter Discord: Paul2708#1098 Mail

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].