Dieser Commit ist enthalten in:
Ursprung
7aafe88ead
Commit
604e683362
@ -47,9 +47,9 @@ import static de.steamwar.schematicsystem.commands.SchematicCommandUtils.*;
|
|||||||
|
|
||||||
public class SchematicCommand extends SWCommand {
|
public class SchematicCommand extends SWCommand {
|
||||||
|
|
||||||
Map<String, TypeMapper<?>> searchMapper = new HashMap<>();
|
private static final Map<String, TypeMapper<?>> searchMapper = new HashMap<>();
|
||||||
|
|
||||||
{
|
static {
|
||||||
searchMapper.put("-type", SWCommandUtils.createMapper(SchematicType.values().stream().map(SchematicType::name).toArray(String[]::new)));
|
searchMapper.put("-type", SWCommandUtils.createMapper(SchematicType.values().stream().map(SchematicType::name).toArray(String[]::new)));
|
||||||
searchMapper.put("-owner", SWCommandUtils.createMapper(Function.identity(), (commandSender, s) -> Collections.singletonList(s)));
|
searchMapper.put("-owner", SWCommandUtils.createMapper(Function.identity(), (commandSender, s) -> Collections.singletonList(s)));
|
||||||
Class<?> clazz = Material.class;
|
Class<?> clazz = Material.class;
|
||||||
@ -278,10 +278,19 @@ public class SchematicCommand extends SWCommand {
|
|||||||
int finalI = i;
|
int finalI = i;
|
||||||
switch (current) {
|
switch (current) {
|
||||||
case "-type":
|
case "-type":
|
||||||
predicates.add(node -> node.getSchemtype().name().equals(query[finalI + 1]));
|
predicates.add(node -> node.getSchemtype().name().equalsIgnoreCase(query[finalI + 1]));
|
||||||
break;
|
break;
|
||||||
case "-item":
|
case "-item":
|
||||||
predicates.add(node -> node.getItem().equals(query[finalI + 1]));
|
predicates.add(node -> node.getItem().equalsIgnoreCase(query[finalI + 1]));
|
||||||
|
break;
|
||||||
|
case "-owner":
|
||||||
|
try {
|
||||||
|
SteamwarUser steamwarUser = SteamwarUser.get(query[finalI + 1]);
|
||||||
|
predicates.add(node -> node.getOwner() == steamwarUser.getId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDer Spieler §e" + query[finalI + 1] + " §cexistiert nicht");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -650,6 +659,9 @@ public class SchematicCommand extends SWCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||||
|
if (strings.length == 0) {
|
||||||
|
return Collections.singletonList(s);
|
||||||
|
}
|
||||||
String last = strings[strings.length - 1];
|
String last = strings[strings.length - 1];
|
||||||
if (searchMapper.containsKey(last)) {
|
if (searchMapper.containsKey(last)) {
|
||||||
TypeMapper<?> mapper = searchMapper.get(last);
|
TypeMapper<?> mapper = searchMapper.get(last);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren