Implement suggestions for Bukkit + Sponge

This commit is contained in:
Kenzie Togami
2019-05-05 22:06:20 -07:00
committed by Kenzie Togami
parent 1c54a04fd1
commit 8a3e6a12b9
15 changed files with 295 additions and 133 deletions

View File

@ -29,6 +29,7 @@ import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.extension.platform.MultiUserPlatform;
import com.sk89q.worldedit.extension.platform.Preference;
import com.sk89q.worldedit.internal.command.CommandUtil;
import com.sk89q.worldedit.sponge.config.SpongeConfiguration;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.registry.Registries;
@ -144,7 +145,7 @@ class SpongePlatform extends AbstractPlatform implements MultiUserPlatform {
public List<String> getSuggestions(CommandSource source, String arguments, @Nullable Location<org.spongepowered.api.world.World> targetPosition) throws CommandException {
CommandSuggestionEvent weEvent = new CommandSuggestionEvent(SpongeWorldEdit.inst().wrapCommandSource(source), command.getName() + " " + arguments);
WorldEdit.getInstance().getEventBus().post(weEvent);
return weEvent.getSuggestions();
return CommandUtil.fixSuggestions(arguments, weEvent.getSuggestions());
}
};
ImmutableList.Builder<String> aliases = ImmutableList.builder();

View File

@ -98,8 +98,6 @@ public class ConfigurateConfiguration extends LocalConfiguration {
superPickaxeDrop = node.getNode("super-pickaxe", "drop-items").getBoolean(superPickaxeDrop);
superPickaxeManyDrop = node.getNode("super-pickaxe", "many-drop-items").getBoolean(superPickaxeManyDrop);
noDoubleSlash = node.getNode("no-double-slash").getBoolean(noDoubleSlash);
useInventory = node.getNode("use-inventory", "enable").getBoolean(useInventory);
useInventoryOverride = node.getNode("use-inventory", "allow-override").getBoolean(useInventoryOverride);
useInventoryCreativeOverride = node.getNode("use-inventory", "creative-mode-overrides").getBoolean(useInventoryCreativeOverride);