Paper/patches/api/0335-Multiple-Entries-with-Scoreboards.patch
Nassim Jahnke 71c84c8132
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD

CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor

Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00

129 lines
5.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Tue, 21 Sep 2021 18:17:34 -0500
Subject: [PATCH] Multiple Entries with Scoreboards
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
index dff76db4a4c37c760144f00c1aa8f2bcac45ba1f..cacb58d25c249e2ecd6083ed0f30d5ffb345220a 100644
--- a/src/main/java/org/bukkit/scoreboard/Team.java
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
@@ -309,6 +309,60 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
*/
void addEntry(@NotNull String entry);
+ // Paper start
+ /**
+ * This puts a collection of entities onto this team for the scoreboard which results in one
+ * packet for the updates rather than a packet-per-entity.
+ * <p>
+ * Entities on other teams will be removed from their respective teams.
+ *
+ * @param entities the entities to add
+ * @throws IllegalArgumentException if entities are null
+ * @throws IllegalStateException if this team has been unregistered
+ */
+ default void addEntities(@NotNull org.bukkit.entity.Entity @NotNull ...entities) {
+ this.addEntities(java.util.List.of(entities));
+ }
+
+ /**
+ * This puts a collection of entities onto this team for the scoreboard which results in one
+ * packet for the updates rather than a packet-per-entity.
+ * <p>
+ * Entities on other teams will be removed from their respective teams.
+ *
+ * @param entities the entities to add
+ * @throws IllegalArgumentException if entities are null
+ * @throws IllegalStateException if this team has been unregistered
+ */
+ void addEntities(@NotNull java.util.Collection<org.bukkit.entity.Entity> entities) throws IllegalStateException, IllegalArgumentException;
+
+ /**
+ * This puts a collection of entries onto this team for the scoreboard which results in one
+ * packet for the updates rather than a packet-per-entry.
+ * <p>
+ * Entries on other teams will be removed from their respective teams.
+ *
+ * @param entries the entries to add
+ * @throws IllegalArgumentException if entries are null
+ * @throws IllegalStateException if this team has been unregistered
+ */
+ default void addEntries(@NotNull String... entries) throws IllegalStateException, IllegalArgumentException {
+ this.addEntries(java.util.List.of(entries));
+ }
+
+ /**
+ * This puts a collection of entries onto this team for the scoreboard which results in one
+ * packet for the updates rather than a packet-per-entry.
+ * <p>
+ * Entries on other teams will be removed from their respective teams.
+ *
+ * @param entries the entries to add
+ * @throws IllegalArgumentException if entries are null
+ * @throws IllegalStateException if this team has been unregistered
+ */
+ void addEntries(@NotNull java.util.Collection<String> entries) throws IllegalStateException, IllegalArgumentException;
+ // Paper end
+
/**
* Removes the player from this team.
*
@@ -329,6 +383,56 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
*/
boolean removeEntry(@NotNull String entry);
+ // Paper start
+ /**
+ * Removes a collection of entities from this team which results in one
+ * packet for the updates rather than a packet-per-entity.
+ *
+ * @param entities the entries to remove
+ * @return if any of the entities were a part of this team
+ * @throws IllegalArgumentException if entities is null
+ * @throws IllegalStateException if this team has been unregistered
+ */
+ default boolean removeEntities(@NotNull org.bukkit.entity.Entity @NotNull ... entities) throws IllegalStateException, IllegalArgumentException {
+ return this.removeEntities(java.util.List.of(entities));
+ }
+
+ /**
+ * Removes a collection of entities from this team which results in one
+ * packet for the updates rather than a packet-per-entity.
+ *
+ * @param entities the entries to remove
+ * @return if any of the entities were a part of this team
+ * @throws IllegalArgumentException if entities is null
+ * @throws IllegalStateException if this team has been unregistered
+ */
+ boolean removeEntities(@NotNull java.util.Collection<org.bukkit.entity.Entity> entities) throws IllegalStateException, IllegalArgumentException;
+
+ /**
+ * Removes a collection of entries from this team which results in one
+ * packet for the updates rather than a packet-per-entry.
+ *
+ * @param entries the entries to remove
+ * @return if any of the entries were a part of this team
+ * @throws IllegalArgumentException if entries is null
+ * @throws IllegalStateException if this team has been unregistered
+ */
+ default boolean removeEntries(@NotNull String... entries) throws IllegalStateException, IllegalArgumentException {
+ return this.removeEntries(java.util.List.of(entries));
+ }
+
+ /**
+ * Removes a collection of entries from this team which results in one
+ * packet for the updates rather than a packet-per-entry.
+ *
+ * @param entries the entries to remove
+ * @return if any of the entries were a part of this team
+ * @throws IllegalArgumentException if entries is null
+ * @throws IllegalStateException if this team has been unregistered
+ */
+ boolean removeEntries(@NotNull java.util.Collection<String> entries) throws IllegalStateException, IllegalArgumentException;
+ // Paper end
+
/**
* Unregisters this team from the Scoreboard
*