Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*******************************************************************************
* Copyright 2018, 2021 Jorel Ali (Skepter) - MIT License
*
* 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 dev.jorel.commandapi.arguments;
import com.mojang.brigadier.arguments.ArgumentType;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import dev.jorel.commandapi.AbstractArgumentTree;
import dev.jorel.commandapi.CommandPermission;
import dev.jorel.commandapi.executors.CommandArguments;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.function.Predicate;
/**
* The core abstract class for Command API arguments
*
* @param The type of the underlying object that this argument casts to
* @param The class extending this class, used as the return type for chain calls
* @param The implementation of Argument used by the class extending this class
* @param The CommandSender class used by the class extending this class
*/
public abstract class AbstractArgument
/// @endcond
, Argument
/// @cond DOX
extends AbstractArgument, ?, Argument, CommandSender>
/// @endcond
, CommandSender> extends AbstractArgumentTree {
/**
* Returns the primitive type of the current Argument. After executing a
* command, this argument should yield an object of this returned class.
*
* @return the type that this argument yields when the command is run
*/
public abstract Class getPrimitiveType();
/**
* Returns the argument type for this argument.
*
* @return the argument type for this argument
*/
public abstract CommandAPIArgumentType getArgumentType();
////////////////////////
// Raw Argument Types //
////////////////////////
private final String nodeName;
private final ArgumentType> rawType;
/**
* Constructs an argument with a given NMS/brigadier type.
*
* @param nodeName the name to assign to this argument node
* @param rawType the NMS or brigadier type to be used for this argument
*/
protected AbstractArgument(String nodeName, ArgumentType> rawType) {
this.nodeName = nodeName;
this.rawType = rawType;
}
/**
* Returns the NMS or brigadier type for this argument.
*
* @return the NMS or brigadier type for this argument
*/
public final ArgumentType> getRawType() {
return this.rawType;
}
/**
* Returns the name of this argument's node
*
* @return the name of this argument's node
*/
public final String getNodeName() {
return this.nodeName;
}
/**
* Parses an argument, returning the specific Bukkit object that the argument
* represents. This is intended for use by the internals of the CommandAPI and
* isn't expected to be used outside the CommandAPI
*
* @param