Multiple Entries with Scoreboards
This commit is contained in:
@@ -229,6 +229,21 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||
scoreboard.board.addPlayerToTeam(entry, this.team);
|
||||
}
|
||||
|
||||
// Paper start - Multiple Entries with Scoreboards
|
||||
@Override
|
||||
public void addEntities(java.util.Collection<org.bukkit.entity.Entity> entities) throws IllegalStateException, IllegalArgumentException {
|
||||
this.addEntries(entities.stream().map(entity -> ((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().getScoreboardName()).toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEntries(java.util.Collection<String> entries) throws IllegalStateException, IllegalArgumentException {
|
||||
Preconditions.checkArgument(entries != null, "Entries cannot be null");
|
||||
CraftScoreboard scoreboard = this.checkState();
|
||||
|
||||
((net.minecraft.server.ServerScoreboard) scoreboard.board).addPlayersToTeam(entries, this.team);
|
||||
}
|
||||
// Paper end - Multiple Entries with Scoreboards
|
||||
|
||||
@Override
|
||||
public boolean removePlayer(OfflinePlayer player) {
|
||||
Preconditions.checkArgument(player != null, "OfflinePlayer cannot be null");
|
||||
@@ -248,6 +263,28 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Paper start - Multiple Entries with Scoreboards
|
||||
@Override
|
||||
public boolean removeEntities(java.util.Collection<org.bukkit.entity.Entity> entities) throws IllegalStateException, IllegalArgumentException {
|
||||
return this.removeEntries(entities.stream().map(entity -> ((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().getScoreboardName()).toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeEntries(java.util.Collection<String> entries) throws IllegalStateException, IllegalArgumentException {
|
||||
Preconditions.checkArgument(entries != null, "Entry cannot be null");
|
||||
CraftScoreboard scoreboard = this.checkState();
|
||||
|
||||
for (String entry : entries) {
|
||||
if (this.team.getPlayers().contains(entry)) {
|
||||
((net.minecraft.server.ServerScoreboard) scoreboard.board).removePlayersFromTeam(entries, this.team);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
// Paper end - Multiple Entries with Scoreboards
|
||||
|
||||
@Override
|
||||
public boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException {
|
||||
Preconditions.checkArgument(player != null, "OfflinePlayer cannot be null");
|
||||
|
||||
Reference in New Issue
Block a user