RanksCommand.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.messages.Message;
10
import sh.okx.rankup.ranks.Rank;
11
import sh.okx.rankup.ranks.RankElement;
12
import sh.okx.rankup.ranks.Rankups;
13
14
@RequiredArgsConstructor
15
public class RanksCommand implements CommandExecutor {
16
  private final RankupPlugin plugin;
17
18
  @Override
19
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
20 1 1. onCommand : negated conditional → KILLED
    if (plugin.error(sender)) {
21 1 1. onCommand : replaced boolean return with false for sh/okx/rankup/commands/RanksCommand::onCommand → NO_COVERAGE
      return true;
22
    }
23
24
    Rankups rankups = plugin.getRankups();
25
    RankElement<Rank> playerRank = null;
26
    Rank pRank = null;
27 1 1. onCommand : negated conditional → KILLED
    if (sender instanceof Player) {
28
      playerRank = rankups.getByPlayer((Player) sender);
29 1 1. onCommand : negated conditional → KILLED
      pRank = playerRank == null ? null : playerRank.getRank();
30
    }
31
32 1 1. onCommand : removed call to sh/okx/rankup/RankupPlugin::sendHeaderFooter → SURVIVED
    plugin.sendHeaderFooter(sender, pRank, Message.RANKS_HEADER);
33
34 2 1. onCommand : negated conditional → SURVIVED
2. onCommand : negated conditional → KILLED
    Message message = !(sender instanceof Player && !(playerRank != null && playerRank.hasNext()))
35 2 1. onCommand : negated conditional → SURVIVED
2. onCommand : negated conditional → SURVIVED
        && playerRank == null ? Message.RANKS_INCOMPLETE : Message.RANKS_COMPLETE;
36
    RankElement<Rank> rank = rankups.getTree().getFirst();
37 1 1. onCommand : negated conditional → KILLED
    while (rank.hasNext()) {
38
      RankElement<Rank> next = rank.getNext();
39 1 1. onCommand : negated conditional → KILLED
      if (rank.getRank().equals(pRank)) {
40 1 1. onCommand : removed call to sh/okx/rankup/messages/MessageBuilder::send → KILLED
        plugin.getMessage(sender, Message.RANKS_CURRENT, rank.getRank(), next.getRank()).failIfEmpty().send(sender);
41
        message = Message.RANKS_INCOMPLETE;
42
      } else {
43 1 1. onCommand : removed call to sh/okx/rankup/messages/MessageBuilder::send → KILLED
        plugin.getMessage(sender, message, rank.getRank(), next.getRank()).failIfEmpty().send(sender);
44
      }
45
      rank = next;
46
    }
47 1 1. onCommand : removed call to sh/okx/rankup/RankupPlugin::sendHeaderFooter → SURVIVED
    plugin.sendHeaderFooter(sender, pRank, Message.RANKS_FOOTER);
48 1 1. onCommand : replaced boolean return with false for sh/okx/rankup/commands/RanksCommand::onCommand → SURVIVED
    return true;
49
  }
50
}

Mutations

20

1.1
Location : onCommand
Killed by : sh.okx.rankup.toml.TomlTest.[engine:junit-jupiter]/[class:sh.okx.rankup.toml.TomlTest]/[method:testRanks()]
negated conditional → KILLED

21

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

27

1.1
Location : onCommand
Killed by : sh.okx.rankup.toml.TomlTest.[engine:junit-jupiter]/[class:sh.okx.rankup.toml.TomlTest]/[method:testRanks()]
negated conditional → KILLED

29

1.1
Location : onCommand
Killed by : sh.okx.rankup.toml.TomlTest.[engine:junit-jupiter]/[class:sh.okx.rankup.toml.TomlTest]/[method:testRanks()]
negated conditional → KILLED

32

1.1
Location : onCommand
Killed by : none
removed call to sh/okx/rankup/RankupPlugin::sendHeaderFooter → SURVIVED

34

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

2.2
Location : onCommand
Killed by : sh.okx.rankup.toml.TomlTest.[engine:junit-jupiter]/[class:sh.okx.rankup.toml.TomlTest]/[method:testRanks()]
negated conditional → KILLED

35

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

2.2
Location : onCommand
Killed by : none
negated conditional → SURVIVED

37

1.1
Location : onCommand
Killed by : sh.okx.rankup.toml.TomlTest.[engine:junit-jupiter]/[class:sh.okx.rankup.toml.TomlTest]/[method:testRanks()]
negated conditional → KILLED

39

1.1
Location : onCommand
Killed by : sh.okx.rankup.toml.TomlTest.[engine:junit-jupiter]/[class:sh.okx.rankup.toml.TomlTest]/[method:testRanks()]
negated conditional → KILLED

40

1.1
Location : onCommand
Killed by : sh.okx.rankup.toml.TomlTest.[engine:junit-jupiter]/[class:sh.okx.rankup.toml.TomlTest]/[method:testRanks()]
removed call to sh/okx/rankup/messages/MessageBuilder::send → KILLED

43

1.1
Location : onCommand
Killed by : sh.okx.rankup.toml.TomlTest.[engine:junit-jupiter]/[class:sh.okx.rankup.toml.TomlTest]/[method:testRanks()]
removed call to sh/okx/rankup/messages/MessageBuilder::send → KILLED

47

1.1
Location : onCommand
Killed by : none
removed call to sh/okx/rankup/RankupPlugin::sendHeaderFooter → SURVIVED

48

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

Active mutators

Tests examined


Report generated by PIT 1.7.0