craftbukkit/nms-patches/net/minecraft/network/chat/IChatBaseComponent.patch

28 lines
893 B
Diff
Raw Normal View History

2020-06-25 10:00:00 +10:00
--- a/net/minecraft/server/IChatBaseComponent.java
+++ b/net/minecraft/server/IChatBaseComponent.java
2021-03-09 08:47:33 +11:00
@@ -23,7 +23,23 @@
2020-06-25 10:00:00 +10:00
import java.util.Optional;
import javax.annotation.Nullable;
2021-03-09 08:47:33 +11:00
-public interface IChatBaseComponent extends Message, IChatFormatted {
2020-06-25 10:00:00 +10:00
+// CraftBukkit start
+import com.google.common.collect.Streams;
+import java.util.stream.Stream;
2021-03-09 08:47:33 +11:00
+// CraftBukkit end
+
+public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IChatBaseComponent> { // CraftBukkit
2020-06-25 10:00:00 +10:00
+
2021-03-09 08:47:33 +11:00
+ // CraftBukkit start
2020-06-25 10:00:00 +10:00
+ 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 getChatModifier();