13
0

Fix stuff
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-01-11 17:57:07 +01:00
Ursprung 7aafe88ead
Commit 604e683362

Datei anzeigen

@ -47,9 +47,9 @@ import static de.steamwar.schematicsystem.commands.SchematicCommandUtils.*;
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("-owner", SWCommandUtils.createMapper(Function.identity(), (commandSender, s) -> Collections.singletonList(s)));
Class<?> clazz = Material.class;
@ -278,10 +278,19 @@ public class SchematicCommand extends SWCommand {
int finalI = i;
switch (current) {
case "-type":
predicates.add(node -> node.getSchemtype().name().equals(query[finalI + 1]));
predicates.add(node -> node.getSchemtype().name().equalsIgnoreCase(query[finalI + 1]));
break;
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++;
}
@ -650,6 +659,9 @@ public class SchematicCommand extends SWCommand {
@Override
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
if (strings.length == 0) {
return Collections.singletonList(s);
}
String last = strings[strings.length - 1];
if (searchMapper.containsKey(last)) {
TypeMapper<?> mapper = searchMapper.get(last);