mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-13 02:41:41 +01:00
Get, has, and set argument redirects
This commit is contained in:
parent
2330cb7037
commit
0ce88102ed
@ -26,6 +26,7 @@ public abstract class Argument<T> {
|
|||||||
private final String id;
|
private final String id;
|
||||||
private final boolean allowSpace;
|
private final boolean allowSpace;
|
||||||
private final boolean useRemaining;
|
private final boolean useRemaining;
|
||||||
|
private Argument<?> redirect;
|
||||||
|
|
||||||
private ArgumentCallback callback;
|
private ArgumentCallback callback;
|
||||||
|
|
||||||
@ -188,6 +189,38 @@ public abstract class Argument<T> {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the argument this argument will redirect to.
|
||||||
|
* <p>
|
||||||
|
* A non-null value means that this will redirect to that argument.
|
||||||
|
*
|
||||||
|
* @return The argument this argument will redirect to
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public Argument<?> getRedirect() {
|
||||||
|
return redirect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if an argument has a redirect.
|
||||||
|
* <p>
|
||||||
|
* Mostly used to make sure there isnt an argument after.
|
||||||
|
*
|
||||||
|
* @return If this argument will redirect to an argument.
|
||||||
|
*/
|
||||||
|
public boolean hasRedirect() {
|
||||||
|
return redirect != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the redirect of this argument.
|
||||||
|
*
|
||||||
|
* @param argument The argument to set the redirect to
|
||||||
|
*/
|
||||||
|
public void setRedirect(Argument<?> argument) {
|
||||||
|
this.redirect = argument;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets if the argument has any error callback.
|
* Gets if the argument has any error callback.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user