From e261e720b643bf32777fb4e3323ca5622e37a020 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sat, 28 Jun 2014 17:32:48 -0700 Subject: [PATCH] Removed ParametricCallable's getSuggestions() which isn't quite working. --- .../parametric/ParametricCallable.java | 87 +------------------ 1 file changed, 1 insertion(+), 86 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java b/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java index 8ba6f32c4..c0317c435 100644 --- a/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java +++ b/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java @@ -253,92 +253,7 @@ class ParametricCallable implements CommandCallable { @Override public List getSuggestions(String stringArguments, CommandLocals locals) throws CommandException { - String[] split = CommandContext.split(stringArguments); - CommandContext context = new CommandContext(split, getValueFlags()); - - ContextArgumentStack scoped = new ContextArgumentStack(context); - SuggestionContext suggestable = context.getSuggestionContext(); - - // For /command -f | - // For /command -f flag| - if (suggestable.forFlag()) { - for (ParameterData parameter : parameters) { - if (parameter.getFlag() == suggestable.getFlag()) { - String prefix = context.getFlag(parameter.getFlag()); - if (prefix == null) { - prefix = ""; - } - - return parameter.getBinding().getSuggestions(parameter, prefix); - } - } - - // This should not happen - return new ArrayList(); - } - - int consumerIndex = 0; - ParameterData lastConsumer = null; - String lastConsumed = null; - - for (ParameterData parameter : parameters) { - if (parameter.getFlag() != null) { - continue; // We already handled flags - } - - try { - scoped.mark(); - parameter.getBinding().bind(parameter, scoped, true); - if (scoped.wasConsumed()) { - lastConsumer = parameter; - lastConsumed = scoped.getConsumed(); - consumerIndex++; - } - } catch (MissingParameterException e) { - // For /command value1 |value2 - // For /command |value1 value2 - if (suggestable.forHangingValue()) { - return parameter.getBinding().getSuggestions(parameter, ""); - } else { - // For /command value1| value2 - if (lastConsumer != null) { - return lastConsumer.getBinding() - .getSuggestions(lastConsumer, lastConsumed); - // For /command| value1 value2 - // This should never occur - } else { - throw new RuntimeException("Invalid suggestion context"); - } - } - } catch (ParameterException e) { - if (suggestable.forHangingValue()) { - String name = getDescription().getParameters() - .get(consumerIndex).getName(); - - throw new InvalidUsageException("For parameter '" + name + "': " - + e.getMessage(), getDescription()); - } else { - return parameter.getBinding().getSuggestions(parameter, ""); - } - } - } - - // For /command value1 value2 | - if (suggestable.forHangingValue()) { - // There's nothing that we can suggest because there's no more parameters - // to add on, and we can't change the previous parameter - return new ArrayList(); - } else { - // For /command value1 value2| - if (lastConsumer != null) { - return lastConsumer.getBinding() - .getSuggestions(lastConsumer, lastConsumed); - // This should never occur - } else { - throw new RuntimeException("Invalid suggestion context"); - } - - } + return Collections.emptyList(); } @Override