aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0355-Multiple-Entries-with-Scoreboards.patch
blob: 378ab2020fbc300771b2aead612ae58aefeaa2cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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 51205a71d243195fdf35515374a1e9ef5df26bc0..0f5c49d41c9460da0ba913b4ca8bef375f2c23df 100644
--- a/src/main/java/org/bukkit/scoreboard/Team.java
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
@@ -325,6 +325,60 @@ public interface Team {
      */
     void addEntry(@NotNull String entry) throws IllegalStateException, IllegalArgumentException;
 
+    // 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.
      *
@@ -347,6 +401,56 @@ public interface Team {
      */
     boolean removeEntry(@NotNull String entry) throws IllegalStateException, IllegalArgumentException;
 
+    // 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
      *