SteamWar/SpigotCore
Archiviert
13
0

Hotfix SubCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2021-12-08 18:45:48 +01:00
Ursprung acb23705d8
Commit 66c50bf6e6

Datei anzeigen

@ -103,6 +103,21 @@ class SubCommand {
} }
private GuardChecker getGuardChecker(Parameter parameter, Map<String, GuardChecker> localGuardChecker) { private GuardChecker getGuardChecker(Parameter parameter, Map<String, GuardChecker> localGuardChecker) {
SWCommand.ClassGuard classGuard = parameter.getAnnotation(SWCommand.ClassGuard.class);
if (classGuard != null) {
if (classGuard.value() == null) {
String s = parameter.getType().getTypeName();
if (parameter.isVarArgs()) {
s = parameter.getType().getComponentType().getTypeName();
}
return localGuardChecker.getOrDefault(s, GUARD_FUNCTIONS.getOrDefault(s, null));
}
GuardChecker current = localGuardChecker.getOrDefault(classGuard.value().getTypeName(), GUARD_FUNCTIONS.getOrDefault(classGuard.value().getTypeName(), null));
if (current == null) {
Bukkit.getLogger().log(Level.WARNING, () -> "The guard checker with name '" + classGuard.value().getTypeName() + "' is neither a local guard checker nor a global one");
}
return current;
}
SWCommand.Guard guard = parameter.getAnnotation(SWCommand.Guard.class); SWCommand.Guard guard = parameter.getAnnotation(SWCommand.Guard.class);
if (guard != null) { if (guard != null) {
if (guard.value() == null || guard.value().isEmpty()) { if (guard.value() == null || guard.value().isEmpty()) {