[LIB] Class Mapper Api 2.2.2

A faster way to develope your commands, task, autoregister events, interact mobs without work

  1. jaimetruman
    Native Minecraft Version:
    1.16
    Tested Minecraft Versions:
    • 1.16
    Source Code:
    https://github.com/JaimeTruman/Easy-Bukkit-CommandManager
    Contributors:
    JaimeTruman
    INTRODUCTION

    This library will provide you a much faster way to develop your own plugins without the need to create complex classes or any other complex infrastructure.It will help you to declare your commands, events, mobs very easily keeping the SOLID principles.

    This plugins include: Commands, Tasks, Mobs and Event listener auto register

    SETUP

    To make this library work you have declare: Mapper.build(<base package to scan for classes>, <main plugin class instance>). Now you have to declare what you want to use the plugin for and at the end type startScanning();

    Code (Java):
    @Override
    public void onEnable() {
          String onWrongCommand = ChatColor.DARK_RED + "Command  not found";
          String onWrongSender = ChatColor.DARK_RED + "You have to be in the server";

          Mapper.build("es.jaime", this)
                    .commandMapper(onWrongCommand, onWrongSender)
                    .mobMapper()
                    .eventListenerMapper()
                    .taskMapper()
                    .startScanning();
    }

    COMMAND MAPPER

    Code (Java):
    @Command("helloworld")
    public class HelloWorldCommand implements CommandRunner {
        @Override
        public void execute(CommandSender sender, String[] args) {
            commandSender.sendMessage("Hello " + sender.getName());
        }
    }
    If you want a subcommand runned in other thread, with permissions, being able to be typed in console

    Code (Java):
    @Command(value= "friend list", canBeTypedInConsole = true, permissions = "bukkit.broadcast.user", asynch = true)
    public class FriendListCommand implements CommandRunner {
        @Override
        public void execute(CommandSender sender, String[] args) {
            //TODO ...
        }
    }
    The command class (the one that is annotated and implements CommandRunner) needs to have a constructor without any parameters.

    You still have to declare your commands in plugin.yaml

    TASK MAPPER

    You can create your own task (the ones that extends BukktiRunnable) without taking care to start them. To do it, every task will represent a task. This class needs to:

    Code (Java):
    @Task(40) //It will be executed every 2 seconds
    public class TestTask extends TaskRunner {
       @Override
       public void run () {
           //TODO...
       }
    }
    If you want an initial delay of 1 minute and a period of 30 seconds:

    Code (Java):
    @Task(value = 30 * BukkitTimeUnit.SECOND, delay = BukkitTimeUnit.MINUTE)
    public class TestTask extends TaskRunner {
        @Override
        public void run () {
             //TODO...
        }
    }
    These classes will need to have an empty constructor.

    MOB MAPPER

    If you want a mob/entity in a fixed location that the player can interact with, you can use this part of the plugin. get executed when the player interacts with the mob. Example.

    Code (Java):
    @Mob(x = 0, y = 70, z = 0)
    public class StatsMob implements OnPlayerInteractMob {
        @Override
        public void execute (PlayerInteractEntityEvent event) {
              //TODO...
        }
    }
    These classes will need to have an empty constructor.


    EVENT LISTENER MAPPER

    When you create your plugin event listener you always have to register them. Now with this library you don't need to do it. It will register them for you. The event listener classes need to have an empty constructor.

Recent Updates

  1. no update
  2. Added asynch command
  3. Fixed double scanning