9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-25 09:59:20 +00:00

优化已有斜体判断

This commit is contained in:
XiaoMoMi
2025-08-18 16:13:19 +08:00
parent b7586310f9
commit 3fc0988c13

View File

@@ -66,7 +66,7 @@ public sealed interface LoreModifier<I> extends SimpleNetworkItemDataModifier<I>
}
}
return new SingleLoreModifier<>(new LoreModification(LoreModification.Operation.APPEND, false,
Arrays.stream(rawLore).map(line -> Config.addNonItalicTag() ? FormattedLine.create("<!i>" + line) : FormattedLine.create(line))
Arrays.stream(rawLore).map(line -> Config.addNonItalicTag() && !line.startsWith("<!i>") ? FormattedLine.create("<!i>" + line) : FormattedLine.create(line))
.toArray(FormattedLine[]::new)));
}
@@ -79,7 +79,7 @@ public sealed interface LoreModifier<I> extends SimpleNetworkItemDataModifier<I>
lastPriority = Optional.ofNullable(complexLore.get("priority")).map(it -> ResourceConfigUtils.getAsInt(it, "priority")).orElse(lastPriority);
boolean split = ResourceConfigUtils.getAsBoolean(complexLore.get("split-lines"), "split-lines");
modifications.add(new LoreModificationHolder(new LoreModification(operation, split,
Arrays.stream(content).map(line -> Config.addNonItalicTag() ? FormattedLine.create("<!i>" + line) : FormattedLine.create(line))
Arrays.stream(content).map(line -> Config.addNonItalicTag() && !line.startsWith("<!i>") ? FormattedLine.create("<!i>" + line) : FormattedLine.create(line))
.toArray(FormattedLine[]::new)), lastPriority));
}
}