Make Team extend ForwardingAudience (#9852)
This commit is contained in:
		
					parent
					
						
							
								d1c10d63dc
							
						
					
				
			
			
				commit
				
					
						5cfbe38b31
					
				
			
		
					 5 changed files with 37 additions and 7 deletions
				
			
		| 
						 | 
					@ -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
 | 
					index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
				
			||||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
 | 
					--- a/src/main/java/org/bukkit/scoreboard/Team.java
 | 
				
			||||||
+++ b/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 {
 | 
					@@ -0,0 +0,0 @@ public interface Team {
 | 
				
			||||||
     @NotNull
 | 
					     @NotNull
 | 
				
			||||||
     String getName();
 | 
					     String getName();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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
 | 
					index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
				
			||||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
 | 
					--- a/src/main/java/org/bukkit/scoreboard/Team.java
 | 
				
			||||||
+++ b/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
 | 
					      * Gets the Set of entries on the team
 | 
				
			||||||
      *
 | 
					      *
 | 
				
			||||||
      * @return entries on the team
 | 
					      * @return entries on the team
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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
 | 
					index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
				
			||||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
 | 
					--- a/src/main/java/org/bukkit/scoreboard/Team.java
 | 
				
			||||||
+++ b/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
 | 
					      * @param player the player to add
 | 
				
			||||||
      * @throws IllegalStateException if this team has been unregistered
 | 
					      * @throws IllegalStateException if this team has been unregistered
 | 
				
			||||||
      * @see #addEntry(String)
 | 
					      * @see #addEntry(String)
 | 
				
			||||||
| 
						 | 
					@ -124,7 +124,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
				
			||||||
     void addPlayer(@NotNull OfflinePlayer player);
 | 
					     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
 | 
					      * @return if the player was on this team
 | 
				
			||||||
      * @throws IllegalStateException if this team has been unregistered
 | 
					      * @throws IllegalStateException if this team has been unregistered
 | 
				
			||||||
      * @see #removeEntry(String)
 | 
					      * @see #removeEntry(String)
 | 
				
			||||||
| 
						 | 
					@ -135,7 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
				
			||||||
     boolean removePlayer(@NotNull OfflinePlayer player);
 | 
					     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
 | 
					      * @return true if the player is a member of this team
 | 
				
			||||||
      * @throws IllegalStateException if this team has been unregistered
 | 
					      * @throws IllegalStateException if this team has been unregistered
 | 
				
			||||||
      * @see #hasEntry(String)
 | 
					      * @see #hasEntry(String)
 | 
				
			||||||
| 
						 | 
					@ -146,7 +146,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
				
			||||||
     boolean hasPlayer(@NotNull OfflinePlayer player);
 | 
					     boolean hasPlayer(@NotNull OfflinePlayer player);
 | 
				
			||||||
     /**
 | 
					     /**
 | 
				
			||||||
      * Checks to see if the specified entry is a member of this team.
 | 
					      * 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);
 | 
					     void setOption(@NotNull Option option, @NotNull OptionStatus status);
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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
 | 
					index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
				
			||||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
 | 
					--- a/src/main/java/org/bukkit/scoreboard/Team.java
 | 
				
			||||||
+++ b/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);
 | 
					     void addEntry(@NotNull String entry);
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
| 
						 | 
					@ -69,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
				
			||||||
     /**
 | 
					     /**
 | 
				
			||||||
      * Removes the player from this team.
 | 
					      * 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);
 | 
					     boolean removeEntry(@NotNull String entry);
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4895,6 +4895,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
     @Override
 | 
					     @Override
 | 
				
			||||||
     public String getDisplayName() {
 | 
					     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
 | 
					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
 | 
					index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
				
			||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
 | 
					--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue