Add param syntax and description to all command.

This commit is contained in:
benwoo1110 2020-12-27 23:40:21 +08:00
parent cf05044b13
commit 455b04ce8c
25 changed files with 204 additions and 25 deletions

View File

@ -48,6 +48,9 @@ public class AnchorCommand extends MultiverseCommand {
@Syntax("<name>")
@Description("Create a new anchor point.")
public void onCreateAnchorCommand(@NotNull Player player,
@Syntax("<name>")
@Description("Name of your new anchor.")
@NotNull @Single @Flags("type=anchor name") String anchorName) {
player.sendMessage((this.plugin.getAnchorManager().saveAnchorLocation(anchorName, player.getLocation()))
@ -61,6 +64,9 @@ public class AnchorCommand extends MultiverseCommand {
@CommandCompletion("@anchors")
@Description("Delete an existing anchor point.")
public void onDeleteAnchorCommand(@NotNull CommandSender sender,
@Syntax("<name>")
@Description("Name of anchor you want to delete.")
@NotNull @Single @Flags("type=anchor name") String anchorName) {
sender.sendMessage((this.plugin.getAnchorManager().deleteAnchor(anchorName))

View File

@ -33,7 +33,13 @@ public class CheckCommand extends MultiverseCommand {
@CommandCompletion("@players @destinations|@MVWorlds")
@Description("Checks to see if a player can go to a destination. Prints debug if false.")
public void onCheckCommand(@NotNull CommandSender sender,
@Syntax("[player]")
@Description("Player to check destination on.")
@NotNull @Flags("other,defaultself,fallbackself") Player player,
@Syntax("<destination>")
@Description("Location, can be a world name.")
@NotNull MVDestination destination) {
this.plugin.getMVPerms().tellMeWhyICantDoThis(sender, player, destination);

View File

@ -31,10 +31,16 @@ public class CloneCommand extends MultiverseCommand {
@Subcommand("clone")
@CommandPermission("multiverse.core.clone")
@Syntax("<world> <name>")
@CommandCompletion("@MVWorlds|@unloadedWorlds")
@CommandCompletion("@MVWorlds|@unloadedWorlds @empty")
@Description("Clones a world.")
public void onCloneCommand(@NotNull CommandSender sender,
@Syntax("<world>")
@Description("Current multiverse world")
@NotNull @Conditions("isWorldInConfig") String worldName,
@Syntax("<name>")
@Description("New cloned world name.")
@NotNull @Single @Flags("trim") @Conditions("creatableWorldName") String newWorldName) {
sender.sendMessage((this.plugin.getMVWorldManager().cloneWorld(worldName, newWorldName))

View File

@ -55,7 +55,13 @@ public class ConfigCommand extends MultiverseCommand {
@CommandCompletion("@MVConfigs")
@Description("Set Global MV Variables.")
public void onSetCommand(@NotNull CommandSender sender,
@Syntax("<property>")
@Description("Config option.")
@NotNull @Values("@MVConfigs") String property,
@Syntax("<value>")
@Description("New value for the given config option.")
@NotNull @Single String value) {
property = property.toLowerCase();

View File

@ -36,6 +36,9 @@ public class CoordCommand extends MultiverseCommand {
@CommandCompletion("@players")
@Description("Detailed information on the player's where abouts.")
public void onCoorCommand(@NotNull CommandSender sender,
@Syntax("[player]")
@Description("Player you want coordinate info of.")
@NotNull
@Flags("other,defaultself")
@Conditions("selfOtherPerm:multiverse.core.coord") PlayerWorld targetPlayer) {

View File

@ -38,8 +38,17 @@ public class CreateCommand extends MultiverseCommand {
@CommandCompletion("@empty @environments") //TODO ACF: Add flags tab-complete
@Description("Creates a new world and loads it.")
public void onCreateCommand(@NotNull CommandSender sender,
@Syntax("<name>")
@Description("New world name.")
@NotNull @Flags("trim") @Conditions("creatableWorldName") String worldName,
@Syntax("<env>")
@Description("The world's environment. See: /mv env")
@NotNull World.Environment environment,
@Syntax("[world-flags]")
@Description("Other world settings. See: http://gg.gg/nn8bl")
@Nullable @Optional String[] flagsArray) {
WorldFlags flags = new WorldFlags(sender, this.plugin, flagsArray);

View File

@ -39,6 +39,9 @@ public class DebugCommand extends MultiverseCommand {
@Syntax("<level>")
@Description("Change debug level.")
public void onChangeDebugCommand(@NotNull CommandSender sender,
@Syntax("<level>")
@Description("Set debug mode level, 0 to 3.")
@NotNull @Single String debugLevel) {
int parsedLevel = parseDebugLevel(debugLevel);

View File

@ -34,7 +34,13 @@ public class DeleteCommand extends MultiverseCommand {
@CommandCompletion("@MVWorlds|@unloadedWorlds")
@Description("Deletes a world on your server PERMANENTLY.")
public void onDeleteCommand(@NotNull CommandSender sender,
@NotNull @Single @Flags("trim") @Conditions("isWorldInConfig|validWorldFolder") String worldName) {
@Syntax("<world>")
@Description("Multiverse world you want to delete.")
@NotNull
@Single
@Flags("trim")
@Conditions("isWorldInConfig|validWorldFolder") String worldName) {
this.plugin.getMVCommandManager().getQueueManager().addToQueue(
sender,

View File

@ -38,6 +38,9 @@ public class GameRuleCommand extends MultiverseCommand {
@CommandCompletion("@MVWorlds")
@Description("See the list gamerules values for a given world.")
public void onGameRulesCommand(@NotNull CommandSender sender,
@Syntax("[world]")
@Description("World you want to see game rule info.")
@NotNull @Flags("other,defaultself") MultiverseWorld world) {
World CBWorld = world.getCBWorld();
@ -66,7 +69,13 @@ public class GameRuleCommand extends MultiverseCommand {
@Description("Allows a player to set a gamerule for a given world.")
public <T> void onGameRuleChangeCommand(@NotNull CommandSender sender,
@NotNull Player player,
@Syntax("<rule> <value>")
@Description("Game rule property and value you want to change to.")
@NotNull GameRuleProperty<T> property,
@Syntax("[world]")
@Description("World you want to set this game rule.")
@NotNull @Flags("other,defaultself") MultiverseWorld world) {
if (world.getCBWorld().setGameRule(property.getGameRule(), property.getValue())) {

View File

@ -34,12 +34,21 @@ public class ImportCommand extends MultiverseCommand {
@Subcommand("import")
@CommandPermission("multiverse.core.import")
@Syntax("<world> <env> -g [generator[:id]] [-n]")
@Syntax("<name> <env> -g [generator[:id]] [-n]")
@CommandCompletion("@potentialWorlds @environments") //TODO ACF: Add flags tab-complete
@Description("Imports a new world of the specified type.")
@Description("Imports a new world into multiverse.")
public void onImportCommand(@NotNull CommandSender sender,
@Syntax("<name>")
@Description("Folder name of the world.")
@NotNull @Flags("trim") @Conditions("importableWorldName") String worldName,
@Syntax("<env>")
@Description("The world's environment. See: /mv env")
@NotNull World.Environment environment,
@Syntax("-g [generator[:id]] [-n]")
@Description("Other world settings. See: http://gg.gg/nn8c2")
@Nullable @Optional String[] flagsArray) {
WorldFlags flags = new WorldFlags(sender, this.plugin, flagsArray);

View File

@ -41,7 +41,13 @@ public class InfoCommand extends MultiverseCommand {
@CommandCompletion("@MVWorlds @range:1-3")
@Description("")
public void onInfoCommand(@NotNull CommandSender sender,
@Syntax("[world]")
@Description("World you want to see info.")
@NotNull @Flags("other,defaultself,fallbackself") MultiverseWorld world,
@Syntax("[page]")
@Description("Info page to display.")
@Default("1") int page) {
PageDisplay pageDisplay = new PageDisplay(

View File

@ -36,7 +36,7 @@ public class ListCommand extends MultiverseCommand {
@Subcommand("list")
@CommandPermission("multiverse.core.list.worlds")
@Syntax("[page]")
@Syntax("[filter] [page]")
@Description("Displays a listing of all worlds that you can enter.")
public void onListCommand(@NotNull CommandSender sender,
@Nullable @Optional Player player,

View File

@ -31,8 +31,11 @@ public class LoadCommand extends MultiverseCommand {
@CommandPermission("multiverse.core.load")
@Syntax("<world>")
@CommandCompletion("@unloadedWorlds")
@Description("Loads a world into Multiverse.")
@Description("Loads a world. World must be already in worlds.yml, else please use /mv import.")
public void onLoadCommand(@NotNull CommandSender sender,
@Syntax("<world>")
@Description("Name of world you want to load.")
@NotNull @Flags("type=world name") @Conditions("isUnloadedWorld") String worldName) {
if (!this.plugin.getMVWorldManager().loadWorld(worldName)) {

View File

@ -38,8 +38,17 @@ public class ModifyCommand extends MultiverseCommand {
@CommandCompletion("@setProperties @empty @MVWorlds")
@Description("Modify various aspects of worlds by setting a property. For more info; https://tinyurl.com/nehhzp6")
public void onModifySetCommand(@NotNull CommandSender sender,
@Syntax("<property>")
@Description("Property option key.")
@NotNull @Flags("type=property") @Conditions("validAddProperty:set") String property,
@Syntax("<value>")
@Description("New property value.")
@NotNull @Flags("type=property value") String value,
@Syntax("[world]")
@Description("World that you want property change to apply.")
@NotNull @Flags("other,defaultself") MultiverseWorld world) {
doModifySet(sender, property, value, world);
@ -51,8 +60,17 @@ public class ModifyCommand extends MultiverseCommand {
@CommandCompletion("@addProperties @empty @MVWorlds")
@Description("Modify various aspects of worlds by adding a property. For more info: https://tinyurl.com/nehhzp6")
public void onModifyAddCommand(@NotNull CommandSender sender,
@Syntax("<property>")
@Description("Property option key.")
@NotNull @Flags("type=property") @Conditions("validAddProperty:add") String property,
@Syntax("<value>")
@Description("Property value to add.")
@NotNull @Flags("type=property value") String value,
@Syntax("[world]")
@Description("World that you want property change to apply.")
@NotNull @Flags("other,defaultself") MultiverseWorld world) {
doModifyAdd(sender, property, value, world);
@ -64,8 +82,17 @@ public class ModifyCommand extends MultiverseCommand {
@CommandCompletion("@addProperties @empty @MVWorlds")
@Description("Modify various aspects of worlds by removing a property. For more info: https://tinyurl.com/nehhzp6")
public void onModifyRemoveCommand(@NotNull CommandSender sender,
@Syntax("<property>")
@Description("Property option key.")
@NotNull @Flags("type=property") @Conditions("validAddProperty:remove") String property,
@Syntax("<value>")
@Description("Property value to remove.")
@NotNull @Flags("type=property value") String value,
@Syntax("[world]")
@Description("World that you want property change to apply.")
@NotNull @Flags("other,defaultself") MultiverseWorld world) {
doModifyRemove(sender, property, value, world);
@ -77,7 +104,13 @@ public class ModifyCommand extends MultiverseCommand {
@CommandCompletion("@addProperties @empty @MVWorlds")
@Description("Modify various aspects of worlds by clearing a property. For more info: https://tinyurl.com/nehhzp6")
public void onModifyClearCommand(@NotNull CommandSender sender,
@Syntax("<property>")
@Description("Property option key.")
@NotNull @Flags("type=property") @Conditions("validAddProperty:clear") String property,
@Syntax("[world]")
@Description("World that you want property be cleared.")
@NotNull @Flags("other,defaultself") MultiverseWorld world) {
doModifyClear(sender, property, world);
@ -89,6 +122,9 @@ public class ModifyCommand extends MultiverseCommand {
@CommandCompletion("@MVWorlds")
@Description("Show properties available to set.")
public void onModifyClearCommand(@NotNull CommandSender sender,
@Syntax("[world]")
@Description("World that you want to see current property values set.")
@NotNull @Flags("other,defaultself") MultiverseWorld world) {
doModifyList(sender, world);

View File

@ -39,6 +39,9 @@ public class PurgeCommand extends MultiverseCommand {
@CommandCompletion("all|animals|monsters|@livingEntities")
@Description("Removed the specified type of mob from all worlds.")
public void onPurgeAllCommand(@NotNull CommandSender sender,
@Syntax("<entities>")
@Description("Entity types that you want to remove from all worlds.")
@NotNull @Split(",") String[] targetEntities) {
doPurge(sender, this.plugin.getMVWorldManager().getMVWorlds(), targetEntities);
@ -50,7 +53,13 @@ public class PurgeCommand extends MultiverseCommand {
@CommandCompletion("@MVWorlds|all|animals|monsters|@livingEntities all|animals|monsters|@livingEntities")
@Description("Removed the specified type of mob from the specified world.")
public void onPurgeCommand(@NotNull CommandSender sender,
@Syntax("[world]")
@Description("World that you want to remove entities.")
@NotNull @Flags("other,defaultself,fallbackself") MultiverseWorld world,
@Syntax("<entities>")
@Description("Entity types that you want to remove from a world.")
@NotNull @Split(",") String[] targetEntities) {
doPurge(sender, Collections.singleton(world), targetEntities);

View File

@ -32,12 +32,17 @@ public class RegenCommand extends MultiverseCommand {
@Subcommand("regen")
@CommandPermission("multiverse.core.regen")
@Syntax("<world>")
@Syntax("<world> [-s [seed]]")
@CommandCompletion("@MVWorlds") //TODO ACF: Add flags tab-complete
@Description("Regenerates a world on your server. The previous state will be lost PERMANENTLY.")
public void onRegenCommand(@NotNull CommandSender sender,
//TODO: Allow regen of unloaded worlds.
@Syntax("<world>")
@Description("World that you want to regen.")
@NotNull @Flags("other") MultiverseWorld world,
@Syntax("[-s [seed]]")
@Description("Other world settings. See: http://gg.gg/nn8lk")
@Nullable @Optional String[] flagsArray) {
WorldFlags flags = new WorldFlags(sender, this.plugin, flagsArray);

View File

@ -33,7 +33,13 @@ public class RemoveCommand extends MultiverseCommand {
@Syntax("<world>")
@Description("Unloads a world from Multiverse and removes it from worlds.yml, this does NOT DELETE the world folder.")
public void onRemoveCommand(@NotNull CommandSender sender,
@NotNull @Single @Flags("type=world name") @Conditions("isWorldInConfig") String worldName) {
@Syntax("<world>")
@Description("World you want to remove from mv's knowledge.")
@NotNull
@Single
@Flags("type=world name")
@Conditions("isWorldInConfig") String worldName) {
sender.sendMessage((this.plugin.getMVWorldManager().removeWorldFromConfig(worldName))
? "World removed from config!"

View File

@ -33,10 +33,16 @@ public class ScriptCommand extends MultiverseCommand {
@Subcommand("script")
@CommandPermission("multiverse.core.script")
@Syntax("<script> [player]")
@CommandCompletion(" @players")
@CommandCompletion("@empty @players") //TODO ACF: tab-complete possible scripts.
@Description("Runs a script.")
public void onScriptCommand(@NotNull CommandSender sender,
@Syntax("<script>")
@Description("Script name that you want to run.")
@NotNull String targetScript,
@Syntax("[player]")
@Description("Player that you want to execute the script on.")
@NotNull @Flags("other|defaultself") Player player) {
Buscript scriptAPI = this.plugin.getScriptAPI();

View File

@ -40,7 +40,10 @@ public class SetSpawnCommand extends MultiverseCommand {
@CommandCompletion("@MVWorlds @location:x @location:y @location:z @location:yaw @location:pitch")
@Description("Sets the spawn for the current world.")
public void onSetSpawnCommand(@NotNull CommandSender sender,
//TODO ACF: Split parameter into individual attributes.
@Syntax("[world x y z [yaw pitch]]")
@Description("New location of spawn.")
@NotNull @Flags("other,defaultself,fallbackself") Location location) {
doSpawnSet(sender, location);
@ -52,7 +55,10 @@ public class SetSpawnCommand extends MultiverseCommand {
@CommandCompletion("@MVWorlds @location:x @location:y @location:z @location:yaw @location:pitch")
@Description("Sets the spawn for the current world.")
public void onModifySetSpawnCommand(@NotNull CommandSender sender,
@NotNull @Flags("other") Location location) {
@Syntax("[world x y z [yaw pitch]]")
@Description("New location of spawn.")
@NotNull @Flags("other,defaultself,fallbackself") Location location) {
doSpawnSet(sender, location);
}
@ -67,7 +73,10 @@ public class SetSpawnCommand extends MultiverseCommand {
@CommandCompletion("@MVWorlds @location:x @location:y @location:z @location:yaw @location:pitch")
@Description("Sets the spawn for the current world.")
public void onModifySetSpawnCommand(@NotNull CommandSender sender,
@NotNull @Flags("other") Location location) {
@Syntax("[world x y z [yaw pitch]]")
@Description("New location of spawn.")
@NotNull @Flags("other,defaultself,fallbackself") Location location) {
doSpawnSet(sender, location);
}
@ -82,13 +91,18 @@ public class SetSpawnCommand extends MultiverseCommand {
@CommandCompletion("@MVWorlds @location:x @location:y @location:z @location:yaw @location:pitch")
@Description("Sets the spawn for the current world.")
public void onAliasSetSpawnCommand(@NotNull CommandSender sender,
@NotNull @Flags("other") Location location) {
@Syntax("[world x y z [yaw pitch]]")
@Description("New location of spawn.")
@NotNull @Flags("other,defaultself,fallbackself") Location location) {
doSpawnSet(sender, location);
}
}
private void doSpawnSet(@NotNull CommandSender sender, @NotNull Location location) {
private void doSpawnSet(@NotNull CommandSender sender,
@NotNull Location location) {
World bukkitWorld = location.getWorld();
if (bukkitWorld == null) {
sender.sendMessage("No world found for the spawn location your tried to set.");

View File

@ -34,8 +34,8 @@ public class SilentCommand extends MultiverseCommand {
@Subcommand("silent")
@CommandPermission("multiverse.core.silent")
@Syntax("<true|false|on|off>")
@CommandCompletion("true|false|on|off")
@Syntax("<true|false>")
@CommandCompletion("true|false")
@Description("Reduces the amount of startup messages.")
public void onChangeSilentCommand(@NotNull CommandSender sender,
boolean silent) {

View File

@ -39,10 +39,13 @@ public class SpawnCommand extends MultiverseCommand {
@Syntax("[player]")
@CommandCompletion("@players")
@Description("Teleport another player to the spawn of the world they are in.")
public void onOtherSpawnCommand(@NotNull CommandSender sender,
@NotNull
@Flags("other|defaultself")
@Conditions("selfOtherPerm:multiverse.core.spawn") PlayerWorld targetPlayer) {
public void onSpawnCommand(@NotNull CommandSender sender,
@Syntax("[player]")
@Description("Target player to teleport to spawn.")
@NotNull
@Flags("other|defaultself")
@Conditions("selfOtherPerm:multiverse.core.spawn") PlayerWorld targetPlayer) {
doSpawn(sender, targetPlayer.getPlayer(), targetPlayer.getWorld());
}
@ -54,10 +57,13 @@ public class SpawnCommand extends MultiverseCommand {
@Syntax("[player]")
@CommandCompletion("@players")
@Description("Teleport another player to the spawn of the world they are in.")
public void onOtherSpawnCommand(@NotNull CommandSender sender,
@NotNull
@Flags("other|defaultself")
@Conditions("selfOtherPerm:multiverse.core.spawn") PlayerWorld targetPlayer) {
public void onSpawnCommand(@NotNull CommandSender sender,
@Syntax("[player]")
@Description("Target player to teleport to spawn.")
@NotNull
@Flags("other|defaultself")
@Conditions("selfOtherPerm:multiverse.core.spawn") PlayerWorld targetPlayer) {
doSpawn(sender, targetPlayer.getPlayer(), targetPlayer.getWorld());
}

View File

@ -51,7 +51,13 @@ public class TeleportCommand extends MultiverseCommand {
@CommandCompletion("@players|@MVWorlds|@destinations @MVWorlds|@destinations")
@Description("Allows you to the teleport to a location on your server!")
public void doTeleportCommand(@NotNull CommandSender sender,
@Syntax("[player]")
@Description("Target player to teleport.")
@NotNull @Flags("other,defaultself,fallbackself") Player player,
@Syntax("<destination>")
@Description("Location, can be a world name.")
@NotNull @Flags("type=destination") String destinationName) {
doTeleport(sender, player, destinationName);
@ -71,7 +77,13 @@ public class TeleportCommand extends MultiverseCommand {
@CommandCompletion("@players|@MVWorlds|@destinations @MVWorlds|@destinations")
@Description("Alias for /mv tp")
public void doTeleportCommand(@NotNull CommandSender sender,
@Syntax("[player]")
@Description("Target player to teleport.")
@NotNull @Flags("other,defaultself,fallbackself") Player player,
@Syntax("<destination>")
@Description("Location, can be a world name.")
@NotNull @Flags("type=destination") String destinationName) {
doTeleport(sender, player, destinationName);

View File

@ -33,6 +33,9 @@ public class UnloadCommand extends MultiverseCommand {
@CommandCompletion("@MVWorlds")
@Description("Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file.")
public void onUnloadCommand(@NotNull CommandSender sender,
@Syntax("<world>")
@Description("Name of world you want to unload.")
@NotNull @Flags("other") MultiverseWorld world) {
//TODO API: Should be able to use MVWorld object directly

View File

@ -52,7 +52,13 @@ public class VersionCommand extends MultiverseCommand {
@CommandCompletion("@pasteTypes --include-plugin-list")
@Description("Dumps version info to the console, optionally to pastal service.")
public void onVersionCommand(@NotNull CommandSender sender,
@Syntax("[paste-service]")
@Description("Website to upload your version info to.")
@NotNull PasteServiceType pasteType,
@Syntax("[--include-plugin-list]")
@Description("Whether you want to have plugins list in version info.")
@Nullable @Optional String includePlugin) {
if (sender instanceof Player) {

View File

@ -11,6 +11,7 @@ import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Flags;
import co.aikar.commands.annotation.Optional;
import co.aikar.commands.annotation.Subcommand;
@ -39,9 +40,12 @@ public class WhoCommand extends MultiverseCommand {
@Syntax("[filter]")
public void onWhoAllCommand(@NotNull CommandSender sender,
@Nullable @Optional Player player,
@Syntax("[filter]")
@Description("Filter the player names.")
@Nullable @Optional String filter) {
final Set<Player> visiblePlayers = getVisiblePlayers(player);
Set<Player> visiblePlayers = getVisiblePlayers(player);
sender.sendMessage(ChatColor.AQUA + "--- Worlds and their players --- "
+ visiblePlayers.size() + "/" + this.plugin.getServer().getMaxPlayers());