3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/nms-patches/IChatBaseComponent.patch
2020-06-25 10:00:00 +10:00

26 Zeilen
859 B
Diff

--- a/net/minecraft/server/IChatBaseComponent.java
+++ b/net/minecraft/server/IChatBaseComponent.java
@@ -22,8 +22,21 @@
import java.util.Map.Entry;
import java.util.Optional;
import javax.annotation.Nullable;
+// CraftBukkit start
+import com.google.common.collect.Streams;
+import java.util.stream.Stream;
-public interface IChatBaseComponent extends Message, IChatFormatted {
+public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IChatBaseComponent> {
+
+ 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();