MaxRankupCommand.java

1
package sh.okx.rankup.commands;
2
3
import lombok.RequiredArgsConstructor;
4
import org.bukkit.command.Command;
5
import org.bukkit.command.CommandExecutor;
6
import org.bukkit.command.CommandSender;
7
import org.bukkit.entity.Player;
8
import sh.okx.rankup.RankupPlugin;
9
import sh.okx.rankup.RankupHelper;
10
import sh.okx.rankup.ranks.Rank;
11
import sh.okx.rankup.ranks.RankElement;
12
13
@RequiredArgsConstructor
14
public class MaxRankupCommand implements CommandExecutor {
15
  private final RankupPlugin plugin;
16
17
  @Override
18
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
19 1 1. onCommand : negated conditional → NO_COVERAGE
    if (!(sender instanceof Player)) {
20 1 1. onCommand : replaced boolean return with true for sh/okx/rankup/commands/MaxRankupCommand::onCommand → NO_COVERAGE
      return false;
21
    }
22
    RankupHelper helper = plugin.getHelper();
23
24
    Player player = (Player) sender;
25
26 1 1. onCommand : negated conditional → NO_COVERAGE
    if (!helper.checkRankup(player)) {
27 1 1. onCommand : replaced boolean return with false for sh/okx/rankup/commands/MaxRankupCommand::onCommand → NO_COVERAGE
      return true;
28
    }
29
30
    do {
31
      RankElement<Rank> rank = plugin.getRankups().getByPlayer(player);
32 1 1. onCommand : removed call to sh/okx/rankup/ranks/Rank::applyRequirements → NO_COVERAGE
      rank.getRank().applyRequirements(player);
33
34 1 1. onCommand : removed call to sh/okx/rankup/RankupHelper::doRankup → NO_COVERAGE
      helper.doRankup(player, rank);
35
36
      // if the individual-messages setting is disabled, only send the "well done you ranked up"
37
      // messages if they can't rank up any more.
38 1 1. onCommand : negated conditional → NO_COVERAGE
      if (plugin.getConfig().getBoolean("max-rankup.individual-messages")
39 1 1. onCommand : negated conditional → NO_COVERAGE
          || !helper.checkRankup(player, false)) {
40 1 1. onCommand : removed call to sh/okx/rankup/RankupHelper::sendRankupMessages → NO_COVERAGE
        helper.sendRankupMessages(player, rank);
41
      }
42 1 1. onCommand : negated conditional → NO_COVERAGE
    } while (helper.checkRankup(player, false));
43
44 1 1. onCommand : replaced boolean return with false for sh/okx/rankup/commands/MaxRankupCommand::onCommand → NO_COVERAGE
    return true;
45
  }
46
}

Mutations

19

1.1
Location : onCommand
Killed by : none
negated conditional → NO_COVERAGE

20

1.1
Location : onCommand
Killed by : none
replaced boolean return with true for sh/okx/rankup/commands/MaxRankupCommand::onCommand → NO_COVERAGE

26

1.1
Location : onCommand
Killed by : none
negated conditional → NO_COVERAGE

27

1.1
Location : onCommand
Killed by : none
replaced boolean return with false for sh/okx/rankup/commands/MaxRankupCommand::onCommand → NO_COVERAGE

32

1.1
Location : onCommand
Killed by : none
removed call to sh/okx/rankup/ranks/Rank::applyRequirements → NO_COVERAGE

34

1.1
Location : onCommand
Killed by : none
removed call to sh/okx/rankup/RankupHelper::doRankup → NO_COVERAGE

38

1.1
Location : onCommand
Killed by : none
negated conditional → NO_COVERAGE

39

1.1
Location : onCommand
Killed by : none
negated conditional → NO_COVERAGE

40

1.1
Location : onCommand
Killed by : none
removed call to sh/okx/rankup/RankupHelper::sendRankupMessages → NO_COVERAGE

42

1.1
Location : onCommand
Killed by : none
negated conditional → NO_COVERAGE

44

1.1
Location : onCommand
Killed by : none
replaced boolean return with false for sh/okx/rankup/commands/MaxRankupCommand::onCommand → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.7.0