All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.jorel.commandapi.Executable Maven / Gradle / Ivy

There is a newer version: 9.5.3
Show newest version
package dev.jorel.commandapi;

import dev.jorel.commandapi.arguments.AbstractArgument;
import dev.jorel.commandapi.commandsenders.AbstractCommandSender;

import java.util.ArrayList;

/**
 * This class represents something that is executable. This is mostly, {@link AbstractCommandAPICommand} instances, or can also be {@link AbstractCommandTree} nodes and even {@link AbstractArgument} nodes in a tree
 *
 * @param  The class extending this class, used as the return type for chain calls
 * @param  The CommandSender class used by the class extending this class
 */
abstract class Executable
/// @endcond
, CommandSender> implements ChainableBuilder {

	/**
	 * The CommandAPIExecutor for this executable implementation
	 */
	protected CommandAPIExecutor> executor = new CommandAPIExecutor<>();

	/**
	 * Returns the executors that this command has
	 * @return the executors that this command has
	 */
	public CommandAPIExecutor> getExecutor() {
		return executor;
	}

	/**
	 * Sets the executors for this command
	 * @param executor the executors for this command
	 */
	public void setExecutor(CommandAPIExecutor> executor) {
		this.executor = executor;
	}

	/**
	 * Clear all executors from the current command builder
	 * @return this command builder
	 */
	public Impl clearExecutors() {
		this.executor.setNormalExecutors(new ArrayList<>());
		this.executor.setResultingExecutors(new ArrayList<>());
		return instance();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy