Skip to content
Permalink
Browse files

End of Partial commits (6). Changes include:

- Update to Intake v4.2
- Update Guava to 22 (for Java8 stream support)
- Update Forge installer to dual dropdown
- Update Forge versions downloader to streams (Java8 madness)
  • Loading branch information...
dries007 committed Jul 22, 2017
1 parent 706d52d commit 8f324749ed9dd924e0e080ab1484b310cc000170
Showing with 5,191 additions and 2,868 deletions.
  1. +1 −1 build.gradle
  2. +10 −7 src/main/java/com/sk89q/intake/Command.java
  3. +38 −18 src/main/java/com/sk89q/intake/CommandCallable.java
  4. +0 −79 src/main/java/com/sk89q/intake/CommandException.java
  5. +4 −4 src/main/java/com/sk89q/intake/CommandMapping.java
  6. +5 −5 src/main/java/com/sk89q/intake/Description.java
  7. +2 −2 src/main/java/com/sk89q/intake/ImmutableCommandMapping.java
  8. +234 −0 src/main/java/com/sk89q/intake/ImmutableDescription.java
  9. +150 −0 src/main/java/com/sk89q/intake/ImmutableParameter.java
  10. +15 −16 src/main/java/com/sk89q/intake/{parametric/binding/StandardBindings.java → Intake.java}
  11. +35 −12 src/main/java/com/sk89q/intake/InvalidUsageException.java
  12. +1 −20 src/main/java/com/sk89q/intake/InvocationCommandException.java
  13. +226 −0 src/main/java/com/sk89q/intake/OptionType.java
  14. +16 −30 src/main/java/com/sk89q/intake/Parameter.java
  15. +0 −130 src/main/java/com/sk89q/intake/SettableDescription.java
  16. +0 −132 src/main/java/com/sk89q/intake/SettableParameter.java
  17. +86 −0 src/main/java/com/sk89q/intake/argument/AbstractCommandArgs.java
  18. +49 −0 src/main/java/com/sk89q/intake/argument/ArgumentException.java
  19. +57 −0 src/main/java/com/sk89q/intake/argument/ArgumentParseException.java
  20. +91 −0 src/main/java/com/sk89q/intake/argument/Arguments.java
  21. +155 −0 src/main/java/com/sk89q/intake/argument/CommandArgs.java
  22. +427 −0 src/main/java/com/sk89q/intake/argument/CommandContext.java
  23. +87 −0 src/main/java/com/sk89q/intake/argument/ContextArgs.java
  24. +50 −0 src/main/java/com/sk89q/intake/argument/MissingArgumentException.java
  25. +35 −0 src/main/java/com/sk89q/intake/argument/MutableStringListArgs.java
  26. +99 −0 src/main/java/com/sk89q/intake/argument/Namespace.java
  27. +97 −0 src/main/java/com/sk89q/intake/argument/StringListArgs.java
  28. +1 −1 src/main/java/com/sk89q/intake/{context → argument}/SuggestionContext.java
  29. +10 −9 ...89q/intake/{parametric/UnconsumedParameterException.java → argument/UnusedArgumentException.java}
  30. +2 −2 src/main/java/com/sk89q/intake/completion/CommandCompleter.java
  31. +2 −2 src/main/java/com/sk89q/intake/completion/NullCompleter.java
  32. +34 −19 src/main/java/com/sk89q/intake/dispatcher/SimpleDispatcher.java
  33. +0 −14 src/main/java/com/sk89q/intake/fluent/DispatcherNode.java
  34. +98 −0 src/main/java/com/sk89q/intake/internal/parametric/BindingList.java
  35. +53 −0 src/main/java/com/sk89q/intake/internal/parametric/ConstantProvider.java
  36. +47 −0 src/main/java/com/sk89q/intake/internal/parametric/InternalBinder.java
  37. +69 −0 src/main/java/com/sk89q/intake/internal/parametric/InternalBinderBuilder.java
  38. +86 −0 src/main/java/com/sk89q/intake/internal/parametric/InternalInjector.java
  39. +58 −0 src/main/java/com/sk89q/intake/parametric/AbstractModule.java
  40. +273 −0 src/main/java/com/sk89q/intake/parametric/AbstractParametricCallable.java
  41. +354 −0 src/main/java/com/sk89q/intake/parametric/ArgumentParser.java
  42. +43 −0 src/main/java/com/sk89q/intake/parametric/Binding.java
  43. +42 −0 src/main/java/com/sk89q/intake/parametric/CommandExecutor.java
  44. +47 −0 src/main/java/com/sk89q/intake/parametric/CommandExecutorWrapper.java
  45. +43 −0 src/main/java/com/sk89q/intake/parametric/IllegalParameterException.java
  46. +112 −0 src/main/java/com/sk89q/intake/parametric/Injector.java
  47. +102 −0 src/main/java/com/sk89q/intake/parametric/Key.java
  48. +141 −0 src/main/java/com/sk89q/intake/parametric/MethodCallable.java
  49. +5 −4 src/main/java/com/sk89q/intake/parametric/{MissingParameterException.java → Module.java}
  50. +0 −196 src/main/java/com/sk89q/intake/parametric/ParameterData.java
  51. +46 −108 src/main/java/com/sk89q/intake/parametric/ParametricBuilder.java
  52. +0 −498 src/main/java/com/sk89q/intake/parametric/ParametricCallable.java
  53. +4 −4 src/main/java/com/sk89q/intake/parametric/ParametricException.java
  54. +67 −0 src/main/java/com/sk89q/intake/parametric/Provider.java
  55. +42 −0 src/main/java/com/sk89q/intake/parametric/ProvisionException.java
  56. +44 −0 src/main/java/com/sk89q/intake/parametric/annotation/Classifier.java
  57. +2 −2 src/main/java/com/sk89q/intake/parametric/annotation/Optional.java
  58. +5 −5 src/main/java/com/sk89q/intake/parametric/annotation/Range.java
  59. +2 −2 src/main/java/com/sk89q/intake/parametric/annotation/Switch.java
  60. +3 −5 src/main/java/com/sk89q/intake/parametric/annotation/Text.java
  61. +6 −6 src/main/java/com/sk89q/intake/parametric/annotation/Validate.java
  62. +0 −79 src/main/java/com/sk89q/intake/parametric/argument/ArgumentStack.java
  63. +0 −180 src/main/java/com/sk89q/intake/parametric/argument/ContextArgumentStack.java
  64. +0 −129 src/main/java/com/sk89q/intake/parametric/argument/StringArgumentStack.java
  65. +51 −0 src/main/java/com/sk89q/intake/parametric/binder/Binder.java
  66. +55 −0 src/main/java/com/sk89q/intake/parametric/binder/BindingBuilder.java
  67. +0 −95 src/main/java/com/sk89q/intake/parametric/binding/Binding.java
  68. +0 −229 src/main/java/com/sk89q/intake/parametric/binding/BindingHelper.java
  69. +0 −67 src/main/java/com/sk89q/intake/parametric/binding/BindingMatch.java
  70. +0 −279 src/main/java/com/sk89q/intake/parametric/binding/PrimitiveBindings.java
  71. +5 −5 src/main/java/com/sk89q/intake/parametric/handler/AbstractInvokeListener.java
  72. +4 −3 src/main/java/com/sk89q/intake/parametric/handler/ExceptionConverter.java
  73. +10 −11 src/main/java/com/sk89q/intake/parametric/handler/ExceptionConverterHelper.java
  74. +41 −51 src/main/java/com/sk89q/intake/parametric/handler/InvokeHandler.java
  75. +11 −13 src/main/java/com/sk89q/intake/parametric/handler/InvokeListener.java
  76. +50 −38 src/main/java/com/sk89q/intake/parametric/handler/LegacyCommandsHandler.java
  77. +50 −0 src/main/java/com/sk89q/intake/parametric/provider/BooleanProvider.java
  78. +55 −0 src/main/java/com/sk89q/intake/parametric/provider/CommandArgsProvider.java
  79. +35 −0 src/main/java/com/sk89q/intake/parametric/provider/DefaultModule.java
  80. +43 −0 src/main/java/com/sk89q/intake/parametric/provider/DoubleProvider.java
  81. +97 −0 src/main/java/com/sk89q/intake/parametric/provider/EnumProvider.java
  82. +44 −0 src/main/java/com/sk89q/intake/parametric/provider/FloatProvider.java
  83. +44 −0 src/main/java/com/sk89q/intake/parametric/provider/IntegerProvider.java
  84. +102 −0 src/main/java/com/sk89q/intake/parametric/provider/NumberProvider.java
  85. +46 −0 src/main/java/com/sk89q/intake/parametric/provider/PrimitivesModule.java
  86. +44 −0 src/main/java/com/sk89q/intake/parametric/provider/ShortProvider.java
  87. +82 −0 src/main/java/com/sk89q/intake/parametric/provider/StringProvider.java
  88. +57 −0 src/main/java/com/sk89q/intake/parametric/provider/TextProvider.java
  89. +3 −2 src/main/java/com/sk89q/intake/util/PrimaryAliasComparator.java
  90. +0 −35 src/main/java/com/sk89q/intake/util/auth/AuthorizationException.java
  91. +5 −5 src/main/java/com/sk89q/intake/util/auth/Authorizer.java
  92. +2 −2 src/main/java/com/sk89q/intake/util/auth/NullAuthorizer.java
  93. +5 −5 src/main/java/com/sk89q/intake/util/auth/Subject.java
  94. +0 −82 src/main/java/net/doubledoordev/backend/TestMain.java
  95. +124 −38 src/main/java/net/doubledoordev/backend/commands/Bindings.java
  96. +43 −38 src/main/java/net/doubledoordev/backend/commands/CommandHandler.java
  97. +3 −3 src/main/java/net/doubledoordev/backend/server/Server.java
  98. +54 −114 src/main/java/net/doubledoordev/backend/util/Cache.java
  99. +80 −0 src/main/java/net/doubledoordev/backend/util/ForgeBuild.java
  100. +3 −7 src/main/java/net/doubledoordev/backend/util/Helper.java
  101. +67 −0 src/main/java/net/doubledoordev/backend/util/Version.java
  102. +0 −3 src/main/java/net/doubledoordev/backend/util/WebSocketHelper.java
  103. +0 −1 src/main/java/net/doubledoordev/backend/web/socket/AdvancedSettingsSocketApplication.java
  104. +63 −21 src/main/resources/templates/server.ftl
@@ -71,7 +71,7 @@ dependencies {
compile group: "net.lingala.zip4j", name: "zip4j", version: "1.3.2"
compile group: "org.glassfish.grizzly", name: "grizzly-http-all", version: "2.3.17"
compile group: "com.flowpowered", name: "flow-nbt", version: "1.0.0"
compile group: "com.google.guava", name: "guava", version: "18.0"
compile group: "com.google.guava", name: "guava", version: "22.0"
compile group: "net.dries007.cmd", name: "CurseModpackDownloader", classifier: "all", version: "1.+"
}

@@ -35,7 +35,7 @@
* A list of aliases for the command. The first alias is the name of
* the command and considered the main alias.
*
* @return aliases for a command
* @return Aliases for a command
*/
String[] aliases();

@@ -45,29 +45,32 @@
* <p>An example would be
* {@code [-h &lt;value&gt;] &lt;name&gt; &lt;message&gt;}.</p>
*
* @return usage instructions for a command
* <p>If a parametric command is used, this field is
* unnecessary because usage information will be generated automatically.</p>
*
* @return Usage instructions for a command
*/
String usage() default "";

/**
* A short description of the command.
*
* @return a short description for the command.
* @return A short description for the command.
*/
String desc();

/**
* The minimum number of arguments. This should be 0 or above.
*
* @return the minimum number of arguments
* @return The minimum number of arguments
*/
int min() default 0;

/**
* The maximum number of arguments. Use -1 for an unlimited number
* of arguments.
*
* @return the maximum number of arguments
* @return The maximum number of arguments
*/
int max() default -1;

@@ -78,7 +81,7 @@
* Appending a flag with a : makes the flag character before a value flag,
* meaning that if it is given, it must have a value.
*
* @return flags matching a-zA-Z
* @return Flags matching a-zA-Z
* @see #anyFlags() to see accept any flag
*/
String flags() default "";
@@ -95,7 +98,7 @@
*
* <p>The value of this property overrides {@link #flags()}.</p>
*
* @return true if so
* @return Whether all flags are accepted
*/
boolean anyFlags() default false;

@@ -19,42 +19,62 @@

package com.sk89q.intake;

import com.sk89q.intake.argument.Namespace;
import com.sk89q.intake.completion.CommandCompleter;
import com.sk89q.intake.context.CommandLocals;
import com.sk89q.intake.util.auth.AuthorizationException;

import java.util.List;

/**
* A command that can be executed.
*/
public interface CommandCallable extends CommandCompleter {

/**
* Execute the correct command based on the input.
* Execute the command.
*
* <p>{@code parentCommands} is a list of "parent" commands, including
* the current command, where each deeper command is appended to
* the list of parent commands.</p>
*
* <p>For example, if the command entered was {@code /world create ocean} and
* the command in question was the "create" command, then:</p>
*
* <ul>
* <li>{@code arguments} would be {@code ocean}</li>
* <li>{@code parentCommands} would be {@code world create}</li>
* </ul>
*
* <p>The implementing class must perform the necessary permission
* checks.</p>
* <p>On the other hand, if the command was "world," then:</p>
*
* @param arguments the arguments
* @param locals the locals
* @param parentCommands a list of parent commands, with the first most entry being the top-level command
* @return the called command, or null if there was no command found
* @throws CommandException thrown on a command error
* <ul>
* <li>{@code arguments} would be {@code create ocean}</li>
* <li>{@code parentCommands} would be {@code world}</li>
* </ul>
*
* @param arguments The arguments
* @param namespace Additional values used for execution
* @param parentCommands The list of parent commands
* @return Whether the command succeeded
* @throws CommandException If there is an error with the command
* @throws InvocationCommandException If there is an error with executing the command
* @throws AuthorizationException If there is a authorization error
*/
boolean call(String arguments, CommandLocals locals, String[] parentCommands) throws CommandException, AuthorizationException;
boolean call(String arguments, Namespace namespace, List<String> parentCommands) throws CommandException, InvocationCommandException, AuthorizationException;

/**
* Get an object describing this command.
*
* @return the command description
* Get the object describing the command.
*
* @return The object describing the command
*/
Description getDescription();

/**
* Test whether this command can be executed with the given context.
* Test whether the user is permitted to use the command.
*
* @param locals the locals
* @return true if execution is permitted
* @param namespace The namespace
* @return Whether permission is provided
*/
boolean testPermission(CommandLocals locals);
boolean testPermission(Namespace namespace);

}
@@ -19,12 +19,8 @@

package com.sk89q.intake;


import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

import static com.google.common.base.Preconditions.checkNotNull;

/**
* Thrown when an executed command raises an error or when execution of
@@ -34,94 +30,19 @@

private final List<String> commandStack = new ArrayList<String>();

/**
* Constructs a new exception with {@code null} as its detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*/
public CommandException() {
}

/**
* Constructs a new exception with the specified detail message. The
* cause is not initialized, and may subsequently be initialized by
* a call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public CommandException(String message) {
super(message);
}

/**
* Constructs a new exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this exception's detail message.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
*/
public CommandException(String message, Throwable cause) {
super(message, cause);
}

/**
* Constructs a new exception with the specified cause and a detail
* message of <tt>(cause==null ? null : cause.toString())</tt> (which
* typically contains the class and detail message of <tt>cause</tt>).
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
*/
public CommandException(Throwable cause) {
super(cause);
}

/**
* Add the command to the stack of commands that are a parent to the
* command that was called.
*
* @param name the parent command
*/
public void prependStack(String name) {
checkNotNull(name);
commandStack.add(name);
}

/**
* 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, String spacedSuffix) {
checkNotNull(prefix);
StringBuilder builder = new StringBuilder();
builder.append(prefix);
ListIterator<String> li = commandStack.listIterator(commandStack.size());
while (li.hasPrevious()) {
if (li.previousIndex() != commandStack.size() - 1) {
builder.append(" ");
}
builder.append(li.previous());
}
if (spacedSuffix != null) {
if (builder.length() > 0) {
builder.append(" ");
}
builder.append(spacedSuffix);
}
return builder.toString().trim();
}

}
@@ -27,28 +27,28 @@
/**
* Get the primary alias.
*
* @return the primary alias
* @return The primary alias
*/
String getPrimaryAlias();

/**
* Get a list of all aliases.
*
* @return aliases
* @return Aliases
*/
String[] getAllAliases();

/**
* Get the callable
*
* @return the callable
* @return The callable
*/
CommandCallable getCallable();

/**
* Get the {@link Description} form the callable.
*
* @return the description
* @return The description
*/
Description getDescription();

@@ -36,21 +36,21 @@
/**
* Get the list of parameters for this command.
*
* @return a list of parameters
* @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
* @return A description, or null if no description is available
*/
String getShortDescription();

/**
* Get a longer help text about this command.
*
* @return a help text, or null if no help is available
* @return A help text, or null if no help is available
*/
String getHelp();

@@ -60,7 +60,7 @@
* <p>A usage string may look like
* {@code [-w &lt;world&gt;] &lt;var1&gt; &lt;var2&gt;}.</p>
*
* @return a usage string
* @return A usage string
*/
String getUsage();

@@ -70,7 +70,7 @@
* <p>Permission data may or may not be available. This is only useful as a
* potential hint.</p>
*
* @return the list of permissions
* @return The list of permissions
*/
List<String> getPermissions();

@@ -34,8 +34,8 @@
/**
* Create a new instance.
*
* @param callable the command callable
* @param alias a list of all aliases, where the first one is the primary one
* @param callable The command callable
* @param alias A list of all aliases, where the first one is the primary one
*/
public ImmutableCommandMapping(CommandCallable callable, String... alias) {
checkNotNull(callable);

0 comments on commit 8f32474

Please sign in to comment.
You can’t perform that action at this time.