We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3321049 commit c65afbdCopy full SHA for c65afbd
src/main/kotlin/dev/fruxz/stacked/extension/Component.kt
@@ -0,0 +1,14 @@
1
+package dev.fruxz.stacked.extension
2
+
3
+import net.kyori.adventure.text.Component
4
5
+/**
6
+ * This extension function allows you to return the current [Component] if it is not null,
7
+ * otherwise it returns the provided [default] [Component].
8
+ * @param default The default [Component] to return if the current one is null.
9
+ * @return The current [Component] or the provided default one.
10
+ * @see Component
11
+ * @author Fruxz
12
+ * @since 2025.5
13
+ */
14
+fun Component?.orElse(default: Component) = this ?: default
0 commit comments