mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Annotate @Param & @Decree & update example
This commit is contained in:
parent
19d1c552fe
commit
305017d523
@ -24,11 +24,11 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class EXAMPLE
|
public class EXAMPLE
|
||||||
{
|
{
|
||||||
@Decree
|
@Decree()
|
||||||
public void kick(
|
public void kick(
|
||||||
@Param(name = "player", description = "The Player to kick from the server", aliases = "p")
|
@Param(name = "player", description = "The Player to kick from the server", aliases = "p")
|
||||||
Player player,
|
Player player,
|
||||||
@Param(name = "reason", description = "A reason to kick the player for", value = "No reason!", aliases = "r")
|
@Param(name = "reason", description = "A reason to kick the player for", value = "No reason!", aliases = "k")
|
||||||
String reason)
|
String reason)
|
||||||
{
|
{
|
||||||
player.kickPlayer(reason);
|
player.kickPlayer(reason);
|
||||||
|
@ -32,11 +32,28 @@ public @interface Decree {
|
|||||||
|
|
||||||
String NO_ALIASES = "No Aliases";
|
String NO_ALIASES = "No Aliases";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of this method, which is the actual Method's name by default
|
||||||
|
*/
|
||||||
String name() default METHOD_NAME;
|
String name() default METHOD_NAME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The description of this command.<br>
|
||||||
|
* Is {@link #DEFAULT_DESCRIPTION} by default
|
||||||
|
*/
|
||||||
String description() default DEFAULT_DESCRIPTION;
|
String description() default DEFAULT_DESCRIPTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The origin this command must come from.<br>
|
||||||
|
* Must be elements of the {@link DecreeOrigin} enum<br>
|
||||||
|
* By default, is {@link DecreeOrigin#BOTH}, meaning both console & player can send the command
|
||||||
|
*/
|
||||||
DecreeOrigin origin() default DecreeOrigin.BOTH;
|
DecreeOrigin origin() default DecreeOrigin.BOTH;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The aliases of this parameter (instead of just the {@link #name() name} (if specified) or Method Name (name of method))<br>
|
||||||
|
* Can be initialized as just a string (ex. "alias") or as an array (ex. {"alias1", "alias2"})<br>
|
||||||
|
* If someone uses /plugin foo and you specify alias="f" here, /plugin f will do the exact same.
|
||||||
|
*/
|
||||||
String[] aliases() default {NO_ALIASES};
|
String[] aliases() default {NO_ALIASES};
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,31 @@ public @interface Param {
|
|||||||
|
|
||||||
String DEFAULT_DESCRIPTION = "No Description Provided";
|
String DEFAULT_DESCRIPTION = "No Description Provided";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main name of this command.<br>
|
||||||
|
* Required parameter.<br>
|
||||||
|
* This is what is used in game, alongside any (if specified) {@link #aliases() aliases}
|
||||||
|
*/
|
||||||
String name();
|
String name();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The description of this parameter, used in help-popups in game.<br>
|
||||||
|
* The default value is {@link #DEFAULT_DESCRIPTION}
|
||||||
|
*/
|
||||||
String description() default DEFAULT_DESCRIPTION;
|
String description() default DEFAULT_DESCRIPTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default value for this argument.<br>
|
||||||
|
* The entered string is parsed to the value similarly to how commandline-text would be.<br>
|
||||||
|
* Default is {@link #REQUIRED}, which indicates the variable MUST be defined.
|
||||||
|
* If you define this, the variable automatically becomes non-required.
|
||||||
|
*/
|
||||||
String value() default REQUIRED;
|
String value() default REQUIRED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The aliases of this parameter (instead of just the {@link #name() name} (if specified) or Method Name (name of method))<br>
|
||||||
|
* Can be initialized as just a string (ex. "alias") or as an array (ex. {"alias1", "alias2"})<br>
|
||||||
|
* If someone uses /plugin foo bar=baz and you specify alias="b" here, /plugin foo b=baz will do the exact same.
|
||||||
|
*/
|
||||||
String[] aliases() default {NO_ALIAS};
|
String[] aliases() default {NO_ALIAS};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user