|
@@ -1,9 +1,12 @@
|
|
package me.lortseam.completeconfig.data;
|
|
package me.lortseam.completeconfig.data;
|
|
|
|
|
|
|
|
+import lombok.Getter;
|
|
import lombok.extern.log4j.Log4j2;
|
|
import lombok.extern.log4j.Log4j2;
|
|
import me.lortseam.completeconfig.data.text.TranslationIdentifier;
|
|
import me.lortseam.completeconfig.data.text.TranslationIdentifier;
|
|
import net.minecraft.text.Text;
|
|
import net.minecraft.text.Text;
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.spongepowered.configurate.CommentedConfigurationNode;
|
|
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.Optional;
|
|
import java.util.Optional;
|
|
@@ -12,10 +15,13 @@ import java.util.Optional;
|
|
public class Collection extends Node {
|
|
public class Collection extends Node {
|
|
|
|
|
|
private final TranslationIdentifier[] customTooltipTranslation;
|
|
private final TranslationIdentifier[] customTooltipTranslation;
|
|
|
|
+ @Getter
|
|
|
|
+ private final String comment;
|
|
|
|
|
|
- Collection(TranslationIdentifier translation, String[] customTooltipTranslationKeys) {
|
|
|
|
|
|
+ Collection(TranslationIdentifier translation, String[] customTooltipTranslationKeys, String comment) {
|
|
super(translation);
|
|
super(translation);
|
|
customTooltipTranslation = ArrayUtils.isNotEmpty(customTooltipTranslationKeys) ? Arrays.stream(customTooltipTranslationKeys).map(key -> translation.root().appendKey(key)).toArray(TranslationIdentifier[]::new) : null;
|
|
customTooltipTranslation = ArrayUtils.isNotEmpty(customTooltipTranslationKeys) ? Arrays.stream(customTooltipTranslationKeys).map(key -> translation.root().appendKey(key)).toArray(TranslationIdentifier[]::new) : null;
|
|
|
|
+ this.comment = !StringUtils.isBlank(comment) ? comment : null;
|
|
}
|
|
}
|
|
|
|
|
|
public Optional<Text[]> getTooltipTranslation() {
|
|
public Optional<Text[]> getTooltipTranslation() {
|
|
@@ -24,4 +30,12 @@ public class Collection extends Node {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void fetch(CommentedConfigurationNode node) {
|
|
|
|
+ if (comment != null) {
|
|
|
|
+ node.comment(comment);
|
|
|
|
+ }
|
|
|
|
+ super.fetch(node);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|