@Wundero added multiple aliases

Merged commit: 9f1cc02812b7ac5af2b08c502bdabe798ebd58c6 by @Wundero
This commit is contained in:
boy0001 2014-12-15 12:33:53 +11:00
parent 7029069e31
commit 439a5da294

View File

@ -23,8 +23,12 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Arrays;
/** /**
* SubCommand class * SubCommand class
* *
@ -46,9 +50,9 @@ public abstract class SubCommand {
*/ */
public final String description; public final String description;
/** /**
* Alias * Aliases
*/ */
public final String alias; public final ArrayList<String> alias;
/** /**
* Command usage * Command usage
*/ */
@ -68,13 +72,33 @@ public abstract class SubCommand {
* @param description Simple description * @param description Simple description
* @param usage Usage description: /plot command {args...} * @param usage Usage description: /plot command {args...}
* @param alias Command alias * @param alias Command alias
* @param category CommandCategory. Pick whichever closests to what you want. * @param category CommandCategory. Pick whichever is closest to what you want.
*/ */
public SubCommand(final String cmd, final String permission, final String description, final String usage, final String alias, final CommandCategory category, final boolean isPlayer) { public SubCommand(final String cmd, final String permission, final String description, final String usage, final String alias, final CommandCategory category, final boolean isPlayer) {
this.cmd = cmd; this.cmd = cmd;
this.permission = new CommandPermission(permission); this.permission = new CommandPermission(permission);
this.description = description; this.description = description;
this.alias = alias; this.alias = new ArrayList<String>();
this.alias.add(alias);
this.usage = usage;
this.category = category;
this.isPlayer = isPlayer;
}
/**
* @param cmd Command /plot {cmd} <-- That!
* @param permission Permission Node
* @param description Simple description
* @param usage Usage description: /plot command {args...}
* @param aliases Command aliases
* @param category CommandCategory. Pick whichever is closest to what you want.
*/
public SubCommand(final String cmd, final String permission, final String description, final String usage, final CommandCategory category, final boolean isPlayer, final String... aliases) {
this.cmd = cmd;
this.permission = new CommandPermission(permission);
this.description = description;
this.alias = new ArrayList<String>();
this.alias.addAll(Arrays.asList(aliases));
this.usage = usage; this.usage = usage;
this.category = category; this.category = category;
this.isPlayer = isPlayer; this.isPlayer = isPlayer;
@ -89,7 +113,8 @@ public abstract class SubCommand {
public SubCommand(final Command command, final String description, final String usage, final CommandCategory category, final boolean isPlayer) { public SubCommand(final Command command, final String description, final String usage, final CommandCategory category, final boolean isPlayer) {
this.cmd = command.getCommand(); this.cmd = command.getCommand();
this.permission = command.getPermission(); this.permission = command.getPermission();
this.alias = command.getAlias(); this.alias = new ArrayList<String>();
this.alias.add(command.getAlias());
this.description = description; this.description = description;
this.usage = usage; this.usage = usage;
this.category = category; this.category = category;