use of org.spongepowered.common.interfaces.IMixinScore in project SpongeCommon by SpongePowered.
the class MixinScoreboardLogic method scoreboard$removeObjective.
@SuppressWarnings({ "rawtypes" })
public void scoreboard$removeObjective(Objective objective) {
ScoreObjective scoreObjective = ((SpongeObjective) objective).getObjectiveFor(this);
this.scoreObjectives.remove(scoreObjective.getName());
for (int i = 0; i < 19; ++i) {
if (this.getObjectiveInDisplaySlot(i) == scoreObjective) {
this.setObjectiveInDisplaySlot(i, null);
}
}
this.sendToPlayers(new SPacketScoreboardObjective(scoreObjective, SpongeScoreboardConstants.OBJECTIVE_PACKET_REMOVE));
List list = this.scoreObjectiveCriterias.get(scoreObjective.getCriteria());
if (list != null) {
list.remove(scoreObjective);
}
for (Map<ScoreObjective, net.minecraft.scoreboard.Score> scoreMap : this.entitiesScoreObjectives.values()) {
Score score = scoreMap.remove(scoreObjective);
if (score != null) {
((IMixinScore) score).getSpongeScore().removeScoreFor(scoreObjective);
}
}
// We deliberately don't call func_96533_c, because there's no need
this.markSaveDataDirty();
((SpongeObjective) objective).removeObjectiveFor(this);
}
Aggregations