com.github.mrivanplays.acf.api.ACFCommandHandler Maven / Gradle / Ivy
Show all versions of IvanACF Show documentation
/*
* *
* * Copyright 2018-2019 MrIvanPlays
* *
* * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
* * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* *
* * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* *
* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package com.github.mrivanplays.acf.api;
import com.github.mrivanplays.acf.util.Comment;
import lombok.NonNull;
import org.bukkit.plugin.Plugin;
import java.util.List;
/**
* Represents a command handler
* with some sneaky peaky register
* methods in it
*/
public interface ACFCommandHandler {
/**
* Register a command
* requires the plugin to be hooked
*
* @param command registered command
*/
@Comment("Requires the plugin to be hooked")
void registerCommand(@NonNull ACFCommand command);
/**
* Gets all commands that you've registered in a list
*
* @return registered commands in list
*/
@Comment("Gets your plugin's registered commands and NOT other plugins'")
List getRegisteredCommands();
/**
* Registers a list of commands
* requires the plugin to be hooked
*
* @param registeredCommands registered commands
*/
@Comment("Requires the plugin be hooked")
default void registerCommands(@NonNull List registeredCommands){
registeredCommands.forEach(this::registerCommand);
}
/**
* Register a command without hooking
*
* @param plugin where's the command assigned to
* @param command registered command
* @deprecated loops thru all plugins and searches for a one depending this one
* if you don't know how to hook your plugin see https://www.spigotmc.org/wiki/hooking/
*/
@Deprecated
void registerCommandNoHook(@NonNull Plugin plugin, @NonNull ACFCommand command);
}