SteamWar/SpigotCore
Archiviert
13
0

Fix SWCommand registering on new instance

Add SWCommandUtils long mapper
Dieser Commit ist enthalten in:
yoyosource 2021-05-05 07:58:23 +02:00
Ursprung 8142224f67
Commit 9dad22742e
2 geänderte Dateien mit 2 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -77,6 +77,7 @@ public abstract class SWCommand {
return strings; return strings;
} }
}; };
unregister();
register(); register();
for (Method method : getClass().getDeclaredMethods()) { for (Method method : getClass().getDeclaredMethods()) {

Datei anzeigen

@ -61,6 +61,7 @@ public class SWCommandUtils {
addMapper(float.class, Float.class, createMapper(numberMapper(Float::parseFloat), numberCompleter(Float::parseFloat))); addMapper(float.class, Float.class, createMapper(numberMapper(Float::parseFloat), numberCompleter(Float::parseFloat)));
addMapper(double.class, Double.class, createMapper(numberMapper(Double::parseDouble), numberCompleter(Double::parseDouble))); addMapper(double.class, Double.class, createMapper(numberMapper(Double::parseDouble), numberCompleter(Double::parseDouble)));
addMapper(int.class, Integer.class, createMapper(numberMapper(Integer::parseInt), numberCompleter(Integer::parseInt))); addMapper(int.class, Integer.class, createMapper(numberMapper(Integer::parseInt), numberCompleter(Integer::parseInt)));
addMapper(long.class, Long.class, createMapper(numberMapper(Long::parseLong), numberCompleter(Long::parseLong)));
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(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 -> {