SteamWar/BauSystem2.0
Archiviert
12
0

Add TraceCommand tabCompletion for ShowModeParameterType

Dieser Commit ist enthalten in:
yoyosource 2021-04-18 09:21:15 +02:00
Ursprung c968e8ca32
Commit 009c197959

Datei anzeigen

@ -31,8 +31,15 @@ import de.steamwar.bausystem.features.tracer.show.mode.TraceEntityShowMode;
import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Linked(LinkageType.COMMAND) @Linked(LinkageType.COMMAND)
public class TraceCommand extends SWCommand { public class TraceCommand extends SWCommand {
@ -40,6 +47,40 @@ public class TraceCommand extends SWCommand {
super("trace", "trail"); super("trace", "trail");
} }
@ClassMapper(value = ShowModeParameterType.class, local = true)
public TypeMapper<ShowModeParameterType> showModeParameterTypesTypeMapper() {
Map<String, ShowModeParameterType> showModeParameterTypesMap = new HashMap<>();
showModeParameterTypesMap.put("-water", ShowModeParameterType.WATER);
showModeParameterTypesMap.put("-interpolatey", ShowModeParameterType.INTERPOLATE_Y);
showModeParameterTypesMap.put("-interpolate-y", ShowModeParameterType.INTERPOLATE_Y);
showModeParameterTypesMap.put("-interpolate_y", ShowModeParameterType.INTERPOLATE_Y);
showModeParameterTypesMap.put("-y", ShowModeParameterType.INTERPOLATE_Y);
showModeParameterTypesMap.put("-interpolatex", ShowModeParameterType.INTERPOLATE_XZ);
showModeParameterTypesMap.put("-interpolate-x", ShowModeParameterType.INTERPOLATE_XZ);
showModeParameterTypesMap.put("-interpolate_x", ShowModeParameterType.INTERPOLATE_XZ);
showModeParameterTypesMap.put("-x", ShowModeParameterType.INTERPOLATE_XZ);
showModeParameterTypesMap.put("-interpolatez", ShowModeParameterType.INTERPOLATE_XZ);
showModeParameterTypesMap.put("-interpolate-z", ShowModeParameterType.INTERPOLATE_XZ);
showModeParameterTypesMap.put("-interpolate_z", ShowModeParameterType.INTERPOLATE_XZ);
showModeParameterTypesMap.put("-z", ShowModeParameterType.INTERPOLATE_XZ);
showModeParameterTypesMap.put("-interpolatexz", ShowModeParameterType.INTERPOLATE_XZ);
showModeParameterTypesMap.put("-interpolate-xz", ShowModeParameterType.INTERPOLATE_XZ);
showModeParameterTypesMap.put("-interpolate_xz", ShowModeParameterType.INTERPOLATE_XZ);
showModeParameterTypesMap.put("-xz", ShowModeParameterType.INTERPOLATE_XZ);
showModeParameterTypesMap.put("-advanced", ShowModeParameterType.ADVANCED);
showModeParameterTypesMap.put("-a", ShowModeParameterType.ADVANCED);
showModeParameterTypesMap.put("advanced", ShowModeParameterType.ADVANCED);
showModeParameterTypesMap.put("a", ShowModeParameterType.ADVANCED);
List<String> tabCompletes = new ArrayList<>(showModeParameterTypesMap.keySet());
return SWCommandUtils.createMapper(s -> showModeParameterTypesMap.getOrDefault(s, null), s -> tabCompletes);
}
@Register(help = true) @Register(help = true)
public void genericHelp(Player p, String... args) { public void genericHelp(Player p, String... args) {
p.sendMessage(ColorConfig.OTHER + "/" + ColorConfig.HIGHLIGHT + "trace start" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Startet die Aufnahme aller TNT-Positionen"); p.sendMessage(ColorConfig.OTHER + "/" + ColorConfig.HIGHLIGHT + "trace start" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Startet die Aufnahme aller TNT-Positionen");