Skip to content

Commit

Permalink
Realised there was a better way to handle arguments, just let the use…
Browse files Browse the repository at this point in the history
…r specify what they want to deal with
  • Loading branch information
rainestormee committed Nov 9, 2020
1 parent 1d3d54d commit c470379
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>com.github.rainestormee</groupId>
<artifactId>JDA-Command</artifactId>
<version>1.1.5</version>
<version>1.1.6</version>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
*/
public interface AbstractCommand<T> extends Comparable<AbstractCommand<T>> {


/**
* Execute this command.
*
* @param message T is the object that is passed to this command
* @param object T is the object that is passed to this command
* @param args The arguments from the command
* @param trigger The trigger used to execute this command.
* @author Raine
* @since 1.1.3
*/
void execute(T message, String args, String trigger);
void execute(T object, Object... args);

/**
* Get the {@link CommandDescription} that annotates this {@link AbstractCommand}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,22 @@ public AbstractCommand<T> findCommand(String trigger) {
* @param args The arguments of the command.
* @since 1.0.0
*/
public void execute(AbstractCommand<T> command, T message, String args, String trigger) {
public void execute(AbstractCommand<T> command, T message, Object... args) {
CommandDescription cd = command.getDescription();
if (cd == null)
return;
command.execute(message, args.trim(), trigger);

command.execute(message, args);
}

/**
* A method which calls {@link #findCommand(String)}, and then {@link #execute(AbstractCommand, T, String, String)} if the found {@link AbstractCommand} is not <code>null</code>
* A method which calls {@link #findCommand(String)}, and then {@link #execute(AbstractCommand, T, Object...)} if the found {@link AbstractCommand} is not <code>null</code>
*
* @param trigger The trigger of the command.
* @param message The {@link T} which triggered the command.
* @param args The args of the command.
* @see #findCommand(String)
* @see #execute(AbstractCommand, T, String, String)
* @see #execute(AbstractCommand, T, Object...)
* @since 1.0.1
*/
public void findAndExecute(String trigger, T message, String args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ public class JDACommandInfo {
*
* @since 1.0.1
*/
public static final String VERSION = "1.1.5";
public static final String VERSION = "1.1.6";
}

0 comments on commit c470379

Please sign in to comment.