Fix SpongeCommand

This commit is contained in:
MattBDev 2016-06-08 19:06:07 -04:00
parent 12c01760a6
commit 8fe381d098

View File

@ -11,6 +11,7 @@ import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.text.Text; import org.spongepowered.api.text.Text;
import org.spongepowered.api.world.World;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -20,7 +21,7 @@ import java.util.Optional;
import java.util.UUID; import java.util.UUID;
public class SpongeCommand implements CommandCallable { public class SpongeCommand implements CommandCallable {
@Override @Override
public CommandResult process(CommandSource source, String arguments) throws CommandException { public CommandResult process(CommandSource source, String arguments) throws CommandException {
TaskManager.runTask(() -> { TaskManager.runTask(() -> {
@ -40,9 +41,10 @@ public class SpongeCommand implements CommandCallable {
}); });
return CommandResult.success(); return CommandResult.success();
} }
@Override @Override
public List<String> getSuggestions(CommandSource source, String arguments) throws CommandException { public List<String> getSuggestions(CommandSource source, String arguments, org.spongepowered.api.world.Location<World> targetPosition)
throws CommandException {
if (!(source instanceof Player)) { if (!(source instanceof Player)) {
return null; return null;
} }
@ -60,26 +62,26 @@ public class SpongeCommand implements CommandCallable {
result.add(o.toString()); result.add(o.toString());
} }
return result.isEmpty() ? null : result; return result.isEmpty() ? null : result;
} }
@Override @Override
public boolean testPermission(CommandSource source) { public boolean testPermission(CommandSource source) {
return true; return true;
} }
@Override @Override
public Optional<Text> getShortDescription(CommandSource source) { public Optional<Text> getShortDescription(CommandSource source) {
return Optional.of(Text.of("Shows plot help")); return Optional.of(Text.of("Shows plot help"));
} }
@Override @Override
public Optional<Text> getHelp(CommandSource source) { public Optional<Text> getHelp(CommandSource source) {
return Optional.of(Text.of("/plot")); return Optional.of(Text.of("/plot"));
} }
@Override @Override
public Text getUsage(CommandSource source) { public Text getUsage(CommandSource source) {
return Text.of("/plot <command>"); return Text.of("/plot <command>");
} }
} }