mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-27 18:06:40 +00:00
Added nested command support.
This commit is contained in:
@ -18,6 +18,8 @@
|
||||
|
||||
package com.sk89q.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* String utilities.
|
||||
*
|
||||
@ -133,4 +135,24 @@ public class StringUtil {
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Join an list of strings into a string.
|
||||
*
|
||||
* @param str
|
||||
* @param delimiter
|
||||
* @param initialIndex
|
||||
* @return
|
||||
*/
|
||||
public static String joinString(List<String> str, String delimiter,
|
||||
int initialIndex) {
|
||||
if (str.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder buffer = new StringBuilder(str.get(initialIndex).toString());
|
||||
for (int i = initialIndex + 1; i < str.size(); i++) {
|
||||
buffer.append(delimiter).append(str.get(i).toString());
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ import java.lang.annotation.RetentionPolicy;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Command {
|
||||
String[] aliases();
|
||||
String usage();
|
||||
String usage() default "";
|
||||
String desc();
|
||||
int min();
|
||||
int max();
|
||||
int min() default 0;
|
||||
int max() default -1;
|
||||
String flags() default "";
|
||||
}
|
||||
|
28
src/com/sk89q/util/commands/NestedCommand.java
Normal file
28
src/com/sk89q/util/commands/NestedCommand.java
Normal file
@ -0,0 +1,28 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (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 PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.util.commands;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface NestedCommand {
|
||||
Class<?>[] value();
|
||||
}
|
Reference in New Issue
Block a user