Fix completions

This commit is contained in:
Aikar
2017-06-03 00:48:08 -04:00
parent 3c6d5bbe63
commit 99a89b2826
7 changed files with 41 additions and 6 deletions
+27
View File
@@ -0,0 +1,27 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ACF (All)" type="MavenRunConfiguration" factoryName="Maven" singleton="true">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings" />
<option name="myRunnerParameters">
<MavenRunnerParameters>
<option name="profiles">
<set />
</option>
<option name="goals">
<list>
<option value="clean" />
<option value="install" />
</list>
</option>
<option name="profilesMap">
<map />
</option>
<option name="resolveToWorkspace" value="false" />
<option name="workingDirPath" value="$PROJECT_DIR$" />
</MavenRunnerParameters>
</option>
</MavenSettings>
<method />
</configuration>
</component>
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="acf-core" type="MavenRunConfiguration" factoryName="Maven" singleton="true">
<configuration default="false" name="ACF (Core Only)" type="MavenRunConfiguration" factoryName="Maven" singleton="true">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings" />
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="acf-example" type="MavenRunConfiguration" factoryName="Maven" singleton="true">
<configuration default="false" name="ACF (Core + Bukkit + Example)" type="MavenRunConfiguration" factoryName="Maven" singleton="true">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings" />
@@ -24,6 +24,7 @@
</MavenSettings>
<method>
<option name="Maven.BeforeRunTask" enabled="true" file="$PROJECT_DIR$/core/pom.xml" goal="clean install" />
<option name="Maven.BeforeRunTask" enabled="true" file="$PROJECT_DIR$/bukkit/pom.xml" goal="clean install" />
</method>
</configuration>
</component>
@@ -31,7 +31,6 @@ import org.bukkit.command.CommandException;
import org.bukkit.command.CommandMap;
import org.bukkit.command.CommandSender;
import org.bukkit.command.SimpleCommandMap;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.server.PluginDisableEvent;
@@ -186,6 +185,11 @@ public class BukkitCommandManager extends CommandManager {
return (R) new BukkitCommandExecutionContext(command, parameter, sender, args, i, passedArgs);
}
@Override
public CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args) {
return new BukkitCommandCompletionContext(command, sender, input, config, args);
}
@Override
public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {
return new RegisteredCommand(command, cmdName, method, prefSubCommand);
@@ -26,6 +26,7 @@ package co.aikar.commands;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;
import sun.reflect.generics.scope.Scope;
import java.util.Collection;
import java.util.HashMap;
@@ -91,10 +92,11 @@ public class CommandCompletions <I, C extends CommandCompletionContext> {
CommandCompletionHandler handler = this.completionMap.get(complete[0].toLowerCase());
if (handler != null) {
String config = complete.length == 1 ? null : complete[1];
CommandCompletionContext context = new CommandCompletionContext(command, sender, input, config, args);
CommandCompletionContext context = manager.createCompletionContext(command, sender, input, config, args);
try {
Collection<String> completions = handler.getCompletions(sender, config, input, context);
//noinspection unchecked
Collection<String> completions = handler.getCompletions(sender.getIssuer(), config, input, context);
if (completions != null) {
allCompletions.addAll(completions);
continue;
@@ -79,6 +79,8 @@ abstract class CommandManager {
public abstract <R extends CommandExecutionContext> R createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs);
public abstract CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args);
public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {
return new RegisteredCommand(command, cmdName, method, prefSubCommand);
}
-1
View File
@@ -101,6 +101,5 @@
<module>paper</module>
<!--module>bungee</module-->
<!--module>sponge</module-->
<module>example</module>
</modules>
</project>