Cleaned up InvalidUsageException and CommandException to be less confusing.

This commit is contained in:
sk89q
2014-06-30 23:02:04 -07:00
parent 08ad5f4451
commit 88f0f1061a
3 changed files with 65 additions and 12 deletions

View File

@ -19,10 +19,13 @@
package com.sk89q.minecraft.util.commands;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import static com.google.common.base.Preconditions.checkNotNull;
public class CommandException extends Exception {
private static final long serialVersionUID = 870638193072101739L;
@ -48,7 +51,16 @@ public class CommandException extends Exception {
commandStack.add(name);
}
public String toStackString(String prefix, String spacedSuffix) {
/**
* Gets the command that was called, which will include the sub-command
* (i.e. "/br sphere").
*
* @param prefix the command shebang character (such as "/") -- may be empty
* @param spacedSuffix a suffix to put at the end (optional) -- may be null
* @return the command that was used
*/
public String getCommandUsed(String prefix, @Nullable String spacedSuffix) {
checkNotNull(prefix);
StringBuilder builder = new StringBuilder();
if (prefix != null) {
builder.append(prefix);