-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added "assert" command tag, created ArgType as an alias for CommandAr…
…gumentType, made CommandCollection merge multiple base commands with the same names into a single command that will attempt to run all of the commands until one works. This behavior is now consistent with child commands.
- Loading branch information
Showing
5 changed files
with
162 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package redempt.redlib.commandmanager; | ||
|
||
import org.bukkit.command.CommandSender; | ||
import redempt.redlib.commandmanager.Command.CommandArgumentType; | ||
|
||
import java.util.function.BiFunction; | ||
import java.util.function.Function; | ||
|
||
/** | ||
* The name for the CommandArgumentType class is rather long. This class exists only | ||
* as an alias for CommandArgumentType to save you a little bit of time. | ||
* @param <T> The type this ArgType represents | ||
*/ | ||
public class ArgType<T> extends CommandArgumentType<T> { | ||
|
||
/** | ||
* Create a CommandArgumentType from a name and converter | ||
* @param name The name of this command argument type, to be used in the command file | ||
* @param convert The {@link Function} to convert from a String to whatever type this converts to | ||
*/ | ||
public ArgType(String name, Function<String, T> convert) { | ||
super(name, convert); | ||
} | ||
|
||
/** | ||
* Create a CommandArgumentType from a name and converter | ||
* @param name The name of this command argument type, to be used in the command file | ||
* @param convert The {@link BiFunction} to convert from a String to whatever type this converts to | ||
*/ | ||
public ArgType(String name, BiFunction<CommandSender, String, T> convert) { | ||
super(name, convert); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters