SteamWar/SpigotCore
Archiviert
13
0

Remove SWCommandUtils StringBuilder support as Mapper

Dieser Commit ist enthalten in:
yoyosource 2021-03-30 09:21:28 +02:00
Ursprung 50b039e6dc
Commit 5a2c06232d
2 geänderte Dateien mit 2 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -180,6 +180,7 @@ public abstract class SWCommand {
@Target({ElementType.METHOD}) @Target({ElementType.METHOD})
protected @interface Register { protected @interface Register {
String[] value() default {}; String[] value() default {};
boolean help() default false; boolean help() default false;
} }
@ -187,6 +188,7 @@ public abstract class SWCommand {
@Target({ElementType.PARAMETER, ElementType.METHOD}) @Target({ElementType.PARAMETER, ElementType.METHOD})
protected @interface Mapper { protected @interface Mapper {
String value(); String value();
boolean local() default false; boolean local() default false;
} }

Datei anzeigen

@ -60,7 +60,6 @@ public class SWCommandUtils {
addMapper(double.class, Double.class, createMapper(Double::parseDouble, numberCompleter(Double::parseDouble))); addMapper(double.class, Double.class, createMapper(Double::parseDouble, numberCompleter(Double::parseDouble)));
addMapper(int.class, Integer.class, createMapper(Integer::parseInt, numberCompleter(Integer::parseInt))); addMapper(int.class, Integer.class, createMapper(Integer::parseInt, numberCompleter(Integer::parseInt)));
MAPPER_FUNCTIONS.put(String.class.getTypeName(), createMapper(s -> s, Collections::singletonList)); MAPPER_FUNCTIONS.put(String.class.getTypeName(), createMapper(s -> s, Collections::singletonList));
MAPPER_FUNCTIONS.put(StringBuilder.class.getTypeName(), createMapper(StringBuilder::new, Collections::singletonList));
MAPPER_FUNCTIONS.put(Player.class.getTypeName(), createMapper(Bukkit::getPlayer, s -> Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList()))); MAPPER_FUNCTIONS.put(Player.class.getTypeName(), createMapper(Bukkit::getPlayer, s -> Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList())));
MAPPER_FUNCTIONS.put(GameMode.class.getTypeName(), createMapper(s -> { MAPPER_FUNCTIONS.put(GameMode.class.getTypeName(), createMapper(s -> {
s = s.toLowerCase(); s = s.toLowerCase();