From c7a1526e12159f32e583d4246a86df69274e70da Mon Sep 17 00:00:00 2001 From: Daniel Naylor Date: Fri, 8 Jun 2018 11:17:02 +0100 Subject: [PATCH] Fix errors with tab completion on Sponge. Fixes #1768 --- .../java/com/plotsquared/sponge/util/SpongeCommand.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java index 3ab235577..16037a44d 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java @@ -1,5 +1,6 @@ package com.plotsquared.sponge.util; +import com.google.common.collect.ImmutableList; import com.intellectualcrafters.plot.commands.MainCommand; import com.intellectualcrafters.plot.object.ConsolePlayer; import com.intellectualcrafters.plot.object.PlotPlayer; @@ -47,7 +48,7 @@ public class SpongeCommand implements CommandCallable { public List getSuggestions(CommandSource source, String arguments, Location targetPosition) throws CommandException { if (!(source instanceof Player)) { - return null; + return ImmutableList.of(); } PlotPlayer player = SpongeUtil.getPlayer((Player) source); String[] args = arguments.split(" "); @@ -56,13 +57,13 @@ public class SpongeCommand implements CommandCallable { } Collection objects = MainCommand.getInstance().tab(player, args, arguments.endsWith(" ")); if (objects == null) { - return null; + return ImmutableList.of(); } List result = new ArrayList<>(); for (Object o : objects) { result.add(o.toString()); } - return result.isEmpty() ? null : result; + return result; } @Override