PrestigesCommand.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.messages.MessageBuilder;
11
import sh.okx.rankup.prestige.Prestige;
12
import sh.okx.rankup.prestige.Prestiges;
13
import sh.okx.rankup.ranks.RankElement;
14
15
@RequiredArgsConstructor
16
public class PrestigesCommand implements CommandExecutor {
17
  private final RankupPlugin plugin;
18
19
  @Override
20
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
21 1 1. onCommand : negated conditional → NO_COVERAGE
    if (plugin.error(sender)) {
22 1 1. onCommand : replaced boolean return with false for sh/okx/rankup/commands/PrestigesCommand::onCommand → NO_COVERAGE
      return true;
23
    }
24
25
    Prestiges prestiges = plugin.getPrestiges();
26
    Prestige playerRank = null;
27 1 1. onCommand : negated conditional → NO_COVERAGE
    if (sender instanceof Player) {
28
      playerRank = prestiges.getRankByPlayer((Player) sender);
29
    }
30
31 1 1. onCommand : removed call to sh/okx/rankup/RankupPlugin::sendHeaderFooter → NO_COVERAGE
    plugin.sendHeaderFooter(sender, playerRank, Message.PRESTIGES_HEADER);
32
33 1 1. onCommand : negated conditional → NO_COVERAGE
    Message message = playerRank == null ? Message.PRESTIGES_INCOMPLETE : Message.PRESTIGES_COMPLETE;
34
    RankElement<Prestige> prestige = prestiges.getTree().getFirst();
35 1 1. onCommand : negated conditional → NO_COVERAGE
    while (prestige.hasNext()) {
36
      RankElement<Prestige> next = prestige.getNext();
37 1 1. onCommand : negated conditional → NO_COVERAGE
      if (prestige.getRank().equals(playerRank)) {
38
        plugin.getMessage(sender, Message.PRESTIGES_CURRENT, prestige.getRank(), next.getRank())
39 1 1. onCommand : removed call to sh/okx/rankup/messages/MessageBuilder::send → NO_COVERAGE
            .send(sender);
40
        message = Message.PRESTIGES_INCOMPLETE;
41
      } else {
42
        MessageBuilder builder = plugin
43
            .getMessage(sender, message, prestige.getRank(), next.getRank());
44 1 1. onCommand : removed call to sh/okx/rankup/messages/MessageBuilder::send → NO_COVERAGE
        builder.send(sender);
45
      }
46
      prestige = next;
47
    }
48
49 1 1. onCommand : removed call to sh/okx/rankup/RankupPlugin::sendHeaderFooter → NO_COVERAGE
    plugin.sendHeaderFooter(sender, playerRank, Message.PRESTIGES_FOOTER);
50 1 1. onCommand : replaced boolean return with false for sh/okx/rankup/commands/PrestigesCommand::onCommand → NO_COVERAGE
    return true;
51
  }
52
}

Mutations

21

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

22

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

27

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

31

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

33

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

35

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

37

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

39

1.1
Location : onCommand
Killed by : none
removed call to sh/okx/rankup/messages/MessageBuilder::send → NO_COVERAGE

44

1.1
Location : onCommand
Killed by : none
removed call to sh/okx/rankup/messages/MessageBuilder::send → NO_COVERAGE

49

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

50

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

Active mutators

Tests examined


Report generated by PIT 1.7.0