Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-26 02:50:06 +01:00
inherit colors
Dieser Commit ist enthalten in:
Ursprung
05992f7fe8
Commit
1a5e8c395a
@ -3,6 +3,7 @@ package com.boydti.fawe.config;
|
|||||||
import com.sk89q.worldedit.util.formatting.WorldEditText;
|
import com.sk89q.worldedit.util.formatting.WorldEditText;
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
import com.sk89q.worldedit.util.formatting.text.serializer.legacy.LegacyComponentSerializer;
|
import com.sk89q.worldedit.util.formatting.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -36,15 +37,22 @@ public class Caption {
|
|||||||
}
|
}
|
||||||
List<Component> children = parent.children();
|
List<Component> children = parent.children();
|
||||||
if (!children.isEmpty()) {
|
if (!children.isEmpty()) {
|
||||||
|
TextColor lastColor = parent.color();
|
||||||
for (int i = 0; i < children.size(); i++) {
|
for (int i = 0; i < children.size(); i++) {
|
||||||
Component child = children.get(i);
|
Component child = children.get(i);
|
||||||
Component coloredChild = color(child);
|
Component coloredChild = color(child);
|
||||||
|
if (coloredChild.color() == null && lastColor != null) {
|
||||||
|
coloredChild = coloredChild.color(lastColor);
|
||||||
|
}
|
||||||
if (coloredChild != child) {
|
if (coloredChild != child) {
|
||||||
if (!(children instanceof ArrayList)) {
|
if (!(children instanceof ArrayList)) {
|
||||||
children = new ArrayList<>(children);
|
children = new ArrayList<>(children);
|
||||||
}
|
}
|
||||||
children.set(i, coloredChild);
|
children.set(i, coloredChild);
|
||||||
}
|
}
|
||||||
|
if (coloredChild.color() != null) {
|
||||||
|
lastColor = coloredChild.color();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (children instanceof ArrayList) {
|
if (children instanceof ArrayList) {
|
||||||
parent = parent.children(children);
|
parent = parent.children(children);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren