Search in sources :

Example 1 with IMixinScore

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);
}
Also used : IMixinScore(org.spongepowered.common.interfaces.IMixinScore) Score(net.minecraft.scoreboard.Score) SpongeScore(org.spongepowered.common.scoreboard.SpongeScore) ScoreObjective(net.minecraft.scoreboard.ScoreObjective) IMixinScoreObjective(org.spongepowered.common.interfaces.IMixinScoreObjective) SPacketScoreboardObjective(net.minecraft.network.play.server.SPacketScoreboardObjective) SpongeObjective(org.spongepowered.common.scoreboard.SpongeObjective) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 SPacketScoreboardObjective (net.minecraft.network.play.server.SPacketScoreboardObjective)1 Score (net.minecraft.scoreboard.Score)1 ScoreObjective (net.minecraft.scoreboard.ScoreObjective)1 IMixinScore (org.spongepowered.common.interfaces.IMixinScore)1 IMixinScoreObjective (org.spongepowered.common.interfaces.IMixinScoreObjective)1 SpongeObjective (org.spongepowered.common.scoreboard.SpongeObjective)1 SpongeScore (org.spongepowered.common.scoreboard.SpongeScore)1