PaperMC/paper-server/nms-patches/net/minecraft/network/chat/IChatBaseComponent.patch

28 lines
930 B
Diff
Raw Normal View History

2021-03-15 23:00:00 +01:00
--- a/net/minecraft/network/chat/IChatBaseComponent.java
+++ b/net/minecraft/network/chat/IChatBaseComponent.java
@@ -40,7 +40,23 @@
2021-03-15 23:00:00 +01:00
import net.minecraft.util.ChatTypeAdapterFactory;
import net.minecraft.util.FormattedString;
-public interface IChatBaseComponent extends Message, IChatFormatted {
+// CraftBukkit start
+import com.google.common.collect.Streams;
+import java.util.stream.Stream;
+// CraftBukkit end
+
+public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IChatBaseComponent> { // CraftBukkit
+
+ // CraftBukkit start
+ default Stream<IChatBaseComponent> stream() {
+ return Streams.concat(new Stream[]{Stream.of(this), this.getSiblings().stream().flatMap(IChatBaseComponent::stream)});
+ }
+
+ @Override
+ default Iterator<IChatBaseComponent> iterator() {
+ return this.stream().iterator();
+ }
+ // CraftBukkit end
ChatModifier getStyle();