PlaytimeMinutesRequirement.java

1
package sh.okx.rankup.requirements.requirement;
2
3
import org.bukkit.Statistic;
4
import org.bukkit.entity.Player;
5
import sh.okx.rankup.RankupPlugin;
6
import sh.okx.rankup.requirements.ProgressiveRequirement;
7
import sh.okx.rankup.requirements.Requirement;
8
9
public class PlaytimeMinutesRequirement extends ProgressiveRequirement {
10
  private static final int TICKS_PER_MINUTE = 20 * 60;
11
  private Statistic playOneTick;
12
13
  public PlaytimeMinutesRequirement(RankupPlugin plugin) {
14
    super(plugin, "playtime-minutes");
15
    try {
16
      playOneTick = Statistic.valueOf("PLAY_ONE_MINUTE");
17
    } catch (IllegalArgumentException e) {
18
      // statistic was changed in 1.13.
19
      playOneTick = Statistic.valueOf("PLAY_ONE_TICK");
20
    }
21
  }
22
23
  protected PlaytimeMinutesRequirement(PlaytimeMinutesRequirement clone) {
24
    super(clone);
25
    this.playOneTick = clone.playOneTick;
26
  }
27
28
  @Override
29
  public double getProgress(Player player) {
30 2 1. getProgress : Replaced integer division with multiplication → NO_COVERAGE
2. getProgress : replaced double return with 0.0d for sh/okx/rankup/requirements/requirement/PlaytimeMinutesRequirement::getProgress → NO_COVERAGE
    return player.getStatistic(playOneTick) / TICKS_PER_MINUTE;
31
  }
32
33
  @Override
34
  public Requirement clone() {
35 1 1. clone : replaced return value with null for sh/okx/rankup/requirements/requirement/PlaytimeMinutesRequirement::clone → NO_COVERAGE
    return new PlaytimeMinutesRequirement(this);
36
  }
37
}

Mutations

30

1.1
Location : getProgress
Killed by : none
Replaced integer division with multiplication → NO_COVERAGE

2.2
Location : getProgress
Killed by : none
replaced double return with 0.0d for sh/okx/rankup/requirements/requirement/PlaytimeMinutesRequirement::getProgress → NO_COVERAGE

35

1.1
Location : clone
Killed by : none
replaced return value with null for sh/okx/rankup/requirements/requirement/PlaytimeMinutesRequirement::clone → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.7.0