13
0

Fix SchematicCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-05-30 13:10:02 +02:00
Ursprung b3d281e189
Commit 39f25462ff

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.schematicsystem.commands; package de.steamwar.schematicsystem.commands;
import de.steamwar.command.AbstractTypeMapper;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils; import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
@ -49,7 +50,7 @@ import static de.steamwar.schematicsystem.commands.SchematicCommandUtils.*;
public class SchematicCommand extends SWCommand { public class SchematicCommand extends SWCommand {
private static final Map<String, TypeMapper<?>> searchMapper = new HashMap<>(); private static final Map<String, AbstractTypeMapper<CommandSender, ?>> searchMapper = new HashMap<>();
static { 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)));
@ -657,8 +658,8 @@ public class SchematicCommand extends SWCommand {
public TypeMapper<SchematicNode> publicDirNodeTypeMapper() { public TypeMapper<SchematicNode> publicDirNodeTypeMapper() {
return new TypeMapper<SchematicNode>() { return new TypeMapper<SchematicNode>() {
@Override @Override
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) { public Collection<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
List<String> list = publicCommandTypeMapper.tabCompletes(commandSender, strings, s); Collection<String> list = publicCommandTypeMapper.tabCompletes(commandSender, strings, s);
list.removeIf(s1 -> !s1.endsWith("/")); list.removeIf(s1 -> !s1.endsWith("/"));
return list; return list;
} }
@ -731,7 +732,7 @@ public class SchematicCommand extends SWCommand {
} }
@Override @Override
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) { public Collection<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
if (strings.length == 0) { if (strings.length == 0) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
list.add(s); list.add(s);
@ -740,7 +741,7 @@ public class SchematicCommand extends SWCommand {
} }
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); AbstractTypeMapper<CommandSender, ?> mapper = searchMapper.get(last);
if (mapper == null) { if (mapper == null) {
List<String> list = new ArrayList<>(searchMapper.keySet()); List<String> list = new ArrayList<>(searchMapper.keySet());
list.add(s); list.add(s);