mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Fixes #1768
This commit is contained in:
parent
dc5fc5af47
commit
9ed5847c0a
@ -1,10 +1,12 @@
|
|||||||
package com.plotsquared.sponge.util;
|
package com.plotsquared.sponge.util;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.commands.MainCommand;
|
import com.intellectualcrafters.plot.commands.MainCommand;
|
||||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.plotsquared.sponge.SpongeMain;
|
import com.plotsquared.sponge.SpongeMain;
|
||||||
import org.spongepowered.api.command.CommandCallable;
|
import org.spongepowered.api.command.CommandCallable;
|
||||||
import org.spongepowered.api.command.CommandException;
|
import org.spongepowered.api.command.CommandException;
|
||||||
@ -15,12 +17,7 @@ import org.spongepowered.api.text.Text;
|
|||||||
import org.spongepowered.api.world.Location;
|
import org.spongepowered.api.world.Location;
|
||||||
import org.spongepowered.api.world.World;
|
import org.spongepowered.api.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class SpongeCommand implements CommandCallable {
|
public class SpongeCommand implements CommandCallable {
|
||||||
|
|
||||||
@ -56,15 +53,23 @@ public class SpongeCommand implements CommandCallable {
|
|||||||
return Collections.singletonList(MainCommand.getInstance().toString());
|
return Collections.singletonList(MainCommand.getInstance().toString());
|
||||||
}
|
}
|
||||||
Collection objects = MainCommand.getInstance().tab(player, args, arguments.endsWith(" "));
|
Collection objects = MainCommand.getInstance().tab(player, args, arguments.endsWith(" "));
|
||||||
if (objects == null) {
|
if (objects != null && !objects.isEmpty()) {
|
||||||
return ImmutableList.of();
|
|
||||||
}
|
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
for (Object o : objects) {
|
for (Object o : objects) {
|
||||||
result.add(o.toString());
|
result.add(o.toString());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
List<String> names = new ArrayList<>();
|
||||||
|
String startsWith = arguments.endsWith(" ") ? "" : args[args.length - 1];
|
||||||
|
for (Map.Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||||
|
String name = entry.getKey();
|
||||||
|
if (name.startsWith(startsWith)) {
|
||||||
|
names.add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean testPermission(CommandSource source) {
|
public boolean testPermission(CommandSource source) {
|
||||||
|
Loading…
Reference in New Issue
Block a user