13
0
geforkt von Mirrors/Paper

Make Team extend ForwardingAudience (#9852)

Dieser Commit ist enthalten in:
powercas_gamer 2023-11-04 21:50:56 +01:00
Ursprung d1c10d63dc
Commit 5cfbe38b31
5 geänderte Dateien mit 37 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -4811,6 +4811,15 @@ diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/scoreboard/Team.java
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
* properties. This team is only relevant to the display of the associated
* {@link #getScoreboard() scoreboard}.
*/
-public interface Team {
+public interface Team extends net.kyori.adventure.audience.ForwardingAudience { // Paper - Make Team extend ForwardingAudience
/**
* Gets the name of this Team
@@ -0,0 +0,0 @@ public interface Team {
@NotNull
String getName();

Datei anzeigen

@ -1232,7 +1232,7 @@ diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/scoreboard/Team.java
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
@@ -0,0 +0,0 @@ public interface Team {
@@ -0,0 +0,0 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
* Gets the Set of entries on the team
*
* @return entries on the team

Datei anzeigen

@ -113,7 +113,7 @@ diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/scoreboard/Team.java
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
@@ -0,0 +0,0 @@ public interface Team {
@@ -0,0 +0,0 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
* @param player the player to add
* @throws IllegalStateException if this team has been unregistered
* @see #addEntry(String)
@ -124,7 +124,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
void addPlayer(@NotNull OfflinePlayer player);
/**
@@ -0,0 +0,0 @@ public interface Team {
@@ -0,0 +0,0 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
* @return if the player was on this team
* @throws IllegalStateException if this team has been unregistered
* @see #removeEntry(String)
@ -135,7 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
boolean removePlayer(@NotNull OfflinePlayer player);
/**
@@ -0,0 +0,0 @@ public interface Team {
@@ -0,0 +0,0 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
* @return true if the player is a member of this team
* @throws IllegalStateException if this team has been unregistered
* @see #hasEntry(String)
@ -146,7 +146,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
boolean hasPlayer(@NotNull OfflinePlayer player);
/**
* Checks to see if the specified entry is a member of this team.
@@ -0,0 +0,0 @@ public interface Team {
@@ -0,0 +0,0 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
*/
void setOption(@NotNull Option option, @NotNull OptionStatus status);

Datei anzeigen

@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/scoreboard/Team.java
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
@@ -0,0 +0,0 @@ public interface Team {
@@ -0,0 +0,0 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
*/
void addEntry(@NotNull String entry);
@ -69,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
* Removes the player from this team.
*
@@ -0,0 +0,0 @@ public interface Team {
@@ -0,0 +0,0 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
*/
boolean removeEntry(@NotNull String entry);

Datei anzeigen

@ -4895,6 +4895,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public String getDisplayName() {
@@ -0,0 +0,0 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
return !(this.team != other.team && (this.team == null || !this.team.equals(other.team)));
}
+ // Paper start - make Team extend ForwardingAudience
+ @Override
+ public @org.jetbrains.annotations.NotNull Iterable<? extends net.kyori.adventure.audience.Audience> audiences() {
+ this.checkState();
+ java.util.List<net.kyori.adventure.audience.Audience> audiences = new java.util.ArrayList<>();
+ for (String playerName : this.team.getPlayers()) {
+ org.bukkit.entity.Player player = Bukkit.getPlayerExact(playerName);
+ if (player != null) {
+ audiences.add(player);
+ }
+ }
+
+ return audiences;
+ }
+ // Paper end - make Team extend ForwardingAudience
+
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java