Skip to content

Commit 9d2af75

Browse files
committed
Fix NoSuchmethodError
1 parent a9f0b92 commit 9d2af75

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

common/src/main/java/com/loohp/multichatdiscordsrvaddon/objectholders/CharacterData.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ public static ValuePairs<String, List<CharObjectPair<CharacterData>>> fromCompon
5656
int color = textColor.value();
5757
OptionalInt shadowColor = OptionalInt.empty();
5858
try {
59-
shadowColor = each.shadowColor() == null ? OptionalInt.empty() : OptionalInt.of(Objects.requireNonNull(each.shadowColor()).value());
60-
} catch (Exception ignored) {}
59+
if (Component.class.getMethod("shadowColor") != null) {
60+
shadowColor = each.shadowColor() == null ? OptionalInt.empty() : OptionalInt.of(Objects.requireNonNull(each.shadowColor()).value());
61+
}
62+
} catch (NoSuchMethodException ignored) {}
6163
List<TextDecoration> decorations = each.decorations().entrySet().stream().filter(entry -> entry.getValue().equals(State.TRUE)).map(entry -> entry.getKey()).collect(Collectors.toList());
6264
String content;
6365
if (each instanceof TextComponent) {

0 commit comments

Comments
 (0)