SteamWar/BauSystem2.0
Archiviert
12
0

Fix ShowModeParameterType and TraceCommand for TabComplete
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-12-26 15:04:28 +01:00
Ursprung 2c77e1a0d1
Commit 851de9575e
2 geänderte Dateien mit 12 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -46,6 +46,9 @@ import org.bukkit.entity.Player;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
@Linked(LinkageType.COMMAND)
public class TraceCommand extends SWCommand {
@ -83,16 +86,19 @@ public class TraceCommand extends SWCommand {
showModeParameterTypeSet.add(showModeParameterTypesMap.get(previousArgument));
}
showModeParameterTypeSet.remove(null);
Set<ShowModeParameterType> removed = showModeParameterTypeSet.stream()
.map(ShowModeParameterType::getRemoved)
.map(Supplier::get)
.flatMap(Arrays::stream)
.collect(Collectors.toSet());
List<String> tabCompletes = new ArrayList<>();
for (Map.Entry<ShowModeParameterType, List<String>> entry : showModeParameterTypeListMap.entrySet()) {
if ((showModeParameterTypeSet.contains(ShowModeParameterType.INTERPOLATE_XZ) || showModeParameterTypeSet.contains(ShowModeParameterType.INTERPOLATE_Y)) && entry.getKey() == ShowModeParameterType.ADVANCED) {
continue;
}
if (showModeParameterTypeSet.contains(entry.getKey())) {
if (removed.contains(entry.getKey()) || showModeParameterTypeSet.contains(entry.getKey())) {
continue;
}
tabCompletes.addAll(entry.getValue());
showModeParameterTypeSet.addAll(Arrays.asList(entry.getKey().getRemoved().get()));
}
return tabCompletes;
}

Datei anzeigen

@ -35,7 +35,7 @@ public enum ShowModeParameterType {
ADVANCED(showModeParameter -> {
showModeParameter.setInterpolate_Y(true);
showModeParameter.setInterpolate_XZ(true);
}, Arrays.asList("-advanced", "-a"), "INTERPOLATE_Y", "INTERPOLATE_XZ"),
}, Arrays.asList("-advanced", "-a", "advanced"), "INTERPOLATE_Y", "INTERPOLATE_XZ"),
EXPLODE(showModeParameter -> showModeParameter.setExplodeOnly(true), Arrays.asList("-explode", "-explodeonly")),
TICKS(showModeParameter -> showModeParameter.setTicks(true), Arrays.asList("-ticks", "-t"));