package io.dico.dicore.command; import io.dico.dicore.command.chat.IChatController; import io.dico.dicore.command.parameter.ArgumentBuffer; import io.dico.dicore.command.predef.PredefinedCommand; import org.bukkit.command.CommandSender; import java.util.List; import java.util.Map; /** * Interface for an address of a command. *
* The address holds what the name and aliases of a command are. * The address also (optionally) holds a reference to a {@link Command} *
* One instance of {@link Command} can be held by multiple addresses, * because the address decides what the command's name and aliases are. *
* The address holds children by key in a map. This map's keys include aliases for its children. * This creates a tree of addresses. If a command is dispatches, the tree is traversed untill a command is found * and no children deeper down match the command (there are exceptions to the later as defined by * {@link Command#takePrecedenceOverSubcommand(String, ArgumentBuffer)} * and {@link Command#isVisibleTo(CommandSender)} */ public interface ICommandAddress { /** * @return true if this address has a parent. */ boolean hasParent(); /** * Get the parent of this address * * @return the parent of this address, or null if none exists. */ ICommandAddress getParent(); /** * @return true if this address has a command. */ boolean hasCommand(); /** * @return true if this address has a command that is not an instance of {@link PredefinedCommand} */ boolean hasUserDeclaredCommand(); /** * @return Get the command of this address, or null if none exists. */ Command getCommand(); /** * @return true if this address is an instance of {@link RootCommandAddress} */ boolean isRoot(); /** * @return the root address of the tree which this address resides in. */ ICommandAddress getRoot(); /** * A list of the names of this address, at the current level. * The first entry is the main key, the subsequent ones are aliases. *
* Untill an address is assigned a parent, this list is mutable. *
* If {@link #isRoot()}, this returns an immutable, empty list.
*
* @return the list of names.
*/
List