use of net.minecraft.server.v1_12_R1.ScoreboardObjective in project PaperDev by Kamillaova.
the class CraftScoreboard method registerNewObjective.
public CraftObjective registerNewObjective(String name, String criteria) throws IllegalArgumentException {
Validate.notNull(name, "Objective name cannot be null");
Validate.notNull(criteria, "Criteria cannot be null");
Validate.isTrue(name.length() <= 16, "The name '" + name + "' is longer than the limit of 16 characters");
Validate.isTrue(board.getObjective(name) == null, "An objective of name '" + name + "' already exists");
CraftCriteria craftCriteria = CraftCriteria.getFromBukkit(criteria);
ScoreboardObjective objective = board.registerObjective(name, craftCriteria.criteria);
return new CraftObjective(this, objective);
}
use of net.minecraft.server.v1_12_R1.ScoreboardObjective in project PaperDev by Kamillaova.
the class CraftScoreboard method getObjectivesByCriteria.
public ImmutableSet<Objective> getObjectivesByCriteria(String criteria) throws IllegalArgumentException {
Validate.notNull(criteria, "Criteria cannot be null");
ImmutableSet.Builder<Objective> objectives = ImmutableSet.builder();
for (ScoreboardObjective netObjective : (Collection<ScoreboardObjective>) this.board.getObjectives()) {
CraftObjective objective = new CraftObjective(this, netObjective);
if (objective.getCriteria().equals(criteria)) {
objectives.add(objective);
}
}
return objectives.build();
}
use of net.minecraft.server.v1_12_R1.ScoreboardObjective in project PaperDev by Kamillaova.
the class CraftScoreboard method getObjective.
public Objective getObjective(String name) throws IllegalArgumentException {
Validate.notNull(name, "Name cannot be null");
ScoreboardObjective nms = board.getObjective(name);
return nms == null ? null : new CraftObjective(this, nms);
}
use of net.minecraft.server.v1_12_R1.ScoreboardObjective in project PaperDev by Kamillaova.
the class CraftScoreboard method getObjective.
public Objective getObjective(DisplaySlot slot) throws IllegalArgumentException {
Validate.notNull(slot, "Display slot cannot be null");
ScoreboardObjective objective = board.getObjectiveForSlot(CraftScoreboardTranslations.fromBukkitSlot(slot));
if (objective == null) {
return null;
}
return new CraftObjective(this, objective);
}
Aggregations