1
0
mirror of https://github.com/plexusorg/Plex-FAWE.git synced 2025-04-17 12:53:01 +00:00
Albert Pham 04c31262f7 Added a new command dispatcher that injects different parameters dynamically.
This reduces the boilerplate code needed to parse arguments in each command, and reduces the need to maintain command documentation with @Command.

Example:

@Command(aliases = "/set", desc = "Set all the blocks inside the selection to a block")
@CommandPermissions("worldedit.region.set")
@Logging(REGION)
void setBlocks(LocalPlayer player, EditSession editSession, @Selection Region region, Pattern replaceWith) {
    // Perform command
}
2013-06-18 14:50:46 -07:00

69 lines
1.8 KiB
Java

// $Id$
/*
* This file is a part of WorldEdit.
* Copyright (c) sk89q <http://www.sk89q.com>
* Copyright (c) the WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.rebar.command;
import java.util.List;
/**
* A description of a command.
*/
public interface Description {
/**
* Get the list of parameters for this command.
*
* @return a list of parameters
*/
List<Parameter> getParameters();
/**
* Get a short one-line description of this command.
*
* @return a description, or null if no description is available
*/
String getDescription();
/**
* Get a longer help text about this command.
*
* @return a help text, or null if no help is available
*/
String getHelp();
/**
* Get the usage string of this command.
*
* <p>A usage string may look like
* <code>[-w &lt;world&gt;] &lt;var1&gt; &lt;var2&gt;</code>.</p>
*
* @return a usage string
*/
String getUsage();
/**
* Get a list of permissions that the player may have to have permission.
*
* <p>Permission data may or may not be available. This is only useful as a
* potential hint.</p>
*
* @return the list of permissions
*/
List<String> getPermissions();
}