mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Improve scoreboard entries
This commit is contained in:
parent
d237e02832
commit
6ad7b27bb3
@ -144,6 +144,15 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective
|
||||
return new CraftScore(this, CraftScoreboard.getScoreHolder(entry));
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@Override
|
||||
public Score getScoreFor(org.bukkit.entity.Entity entity) throws IllegalArgumentException, IllegalStateException {
|
||||
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
||||
this.checkState();
|
||||
return new CraftScore(this, ((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle());
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@Override
|
||||
public void unregister() {
|
||||
CraftScoreboard scoreboard = this.checkState();
|
||||
|
@ -235,6 +235,26 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
|
||||
this.board.setDisplayObjective(CraftScoreboardTranslations.fromBukkitSlot(slot), null);
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@Override
|
||||
public ImmutableSet<Score> getScoresFor(org.bukkit.entity.Entity entity) throws IllegalArgumentException {
|
||||
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
||||
return this.getScores(((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetScoresFor(org.bukkit.entity.Entity entity) throws IllegalArgumentException {
|
||||
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
||||
this.resetScores(((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Team getEntityTeam(org.bukkit.entity.Entity entity) throws IllegalArgumentException {
|
||||
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
||||
return this.getEntryTeam(((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().getScoreboardName());
|
||||
}
|
||||
// Paper end
|
||||
|
||||
// CraftBukkit method
|
||||
public Scoreboard getHandle() {
|
||||
return this.board;
|
||||
|
@ -304,6 +304,26 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||
}
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@Override
|
||||
public void addEntity(org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException {
|
||||
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
||||
this.addEntry(((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().getScoreboardName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeEntity(org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException {
|
||||
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
||||
return this.removeEntry(((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().getScoreboardName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEntity(org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException {
|
||||
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
||||
return this.hasEntry(((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().getScoreboardName());
|
||||
}
|
||||
// Paper end
|
||||
|
||||
public static Visibility bukkitToNotch(NameTagVisibility visibility) {
|
||||
switch (visibility) {
|
||||
case ALWAYS:
|
||||
|
Loading…
Reference in New Issue
Block a user