| 1 | package sh.okx.rankup.prestige; | |
| 2 | ||
| 3 | import java.util.List; | |
| 4 | import lombok.EqualsAndHashCode; | |
| 5 | import lombok.Getter; | |
| 6 | import lombok.ToString; | |
| 7 | import me.clip.placeholderapi.PlaceholderAPI; | |
| 8 | import org.bukkit.Bukkit; | |
| 9 | import org.bukkit.configuration.ConfigurationSection; | |
| 10 | import org.bukkit.entity.Player; | |
| 11 | import sh.okx.rankup.RankupPlugin; | |
| 12 | import sh.okx.rankup.messages.pebble.PebbleMessageBuilder; | |
| 13 | import sh.okx.rankup.ranks.Rank; | |
| 14 | import sh.okx.rankup.ranks.requirements.ListRankRequirements; | |
| 15 | import sh.okx.rankup.ranks.requirements.RankRequirements; | |
| 16 | import sh.okx.rankup.requirements.Requirement; | |
| 17 | ||
| 18 |
26
1. canEqual : replaced boolean return with false for sh/okx/rankup/prestige/Prestige::canEqual → NO_COVERAGE 2. canEqual : replaced boolean return with true for sh/okx/rankup/prestige/Prestige::canEqual → NO_COVERAGE 3. equals : negated conditional → NO_COVERAGE 4. equals : negated conditional → NO_COVERAGE 5. equals : negated conditional → NO_COVERAGE 6. equals : negated conditional → NO_COVERAGE 7. equals : negated conditional → NO_COVERAGE 8. equals : negated conditional → NO_COVERAGE 9. equals : negated conditional → NO_COVERAGE 10. equals : negated conditional → NO_COVERAGE 11. equals : negated conditional → NO_COVERAGE 12. equals : negated conditional → NO_COVERAGE 13. equals : replaced boolean return with false for sh/okx/rankup/prestige/Prestige::equals → NO_COVERAGE 14. equals : replaced boolean return with false for sh/okx/rankup/prestige/Prestige::equals → NO_COVERAGE 15. equals : replaced boolean return with true for sh/okx/rankup/prestige/Prestige::equals → NO_COVERAGE 16. equals : replaced boolean return with true for sh/okx/rankup/prestige/Prestige::equals → NO_COVERAGE 17. equals : replaced boolean return with true for sh/okx/rankup/prestige/Prestige::equals → NO_COVERAGE 18. equals : replaced boolean return with true for sh/okx/rankup/prestige/Prestige::equals → NO_COVERAGE 19. equals : replaced boolean return with true for sh/okx/rankup/prestige/Prestige::equals → NO_COVERAGE 20. hashCode : Replaced integer multiplication with division → NO_COVERAGE 21. hashCode : Replaced integer addition with subtraction → NO_COVERAGE 22. hashCode : Replaced integer multiplication with division → NO_COVERAGE 23. hashCode : Replaced integer addition with subtraction → NO_COVERAGE 24. hashCode : negated conditional → NO_COVERAGE 25. hashCode : negated conditional → NO_COVERAGE 26. hashCode : replaced int return with 0 for sh/okx/rankup/prestige/Prestige::hashCode → NO_COVERAGE |
@EqualsAndHashCode(callSuper = true) |
| 19 |
1
1. toString : replaced return value with "" for sh/okx/rankup/prestige/Prestige::toString → NO_COVERAGE |
@ToString(callSuper = true) |
| 20 | public class Prestige extends Rank { | |
| 21 |
1
1. getFrom : replaced return value with "" for sh/okx/rankup/prestige/Prestige::getFrom → NO_COVERAGE |
@Getter |
| 22 | private final String from; | |
| 23 |
1
1. getTo : replaced return value with "" for sh/okx/rankup/prestige/Prestige::getTo → NO_COVERAGE |
@Getter |
| 24 | private final String to; | |
| 25 | ||
| 26 | protected Prestige(ConfigurationSection section, RankupPlugin plugin, String next, String rank, RankRequirements requirements, List<String> commands, String from, String to) { | |
| 27 | super(section, plugin, next, rank, rank, requirements, commands); | |
| 28 | this.from = from; | |
| 29 | this.to = to; | |
| 30 | } | |
| 31 | ||
| 32 | public static Prestige deserialize(RankupPlugin plugin, ConfigurationSection section) { | |
| 33 | List<String> requirementsList = section.getStringList("requirements"); | |
| 34 | List<Requirement> requirements = plugin.getRequirements().getRequirements(requirementsList); | |
| 35 | ||
| 36 |
1
1. deserialize : replaced return value with null for sh/okx/rankup/prestige/Prestige::deserialize → KILLED |
return new Prestige(section, plugin, |
| 37 | section.getString("next"), | |
| 38 | section.getString("rank"), | |
| 39 | new ListRankRequirements(requirements), | |
| 40 | section.getStringList("commands"), | |
| 41 | section.getString("from"), | |
| 42 | section.getString("to")); | |
| 43 | } | |
| 44 | ||
| 45 | @Override | |
| 46 | public void runCommands(Player player, Rank next) { | |
| 47 | for (String command : commands) { | |
| 48 | String string = new PebbleMessageBuilder(this.plugin, command) | |
| 49 | .replacePlayer(player) | |
| 50 | .replaceOldRank(this) | |
| 51 | .replaceRank(next) | |
| 52 | .toString(); | |
| 53 |
1
1. runCommands : negated conditional → NO_COVERAGE |
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) { |
| 54 | string = PlaceholderAPI.setPlaceholders(player, string); | |
| 55 | } | |
| 56 | Bukkit.dispatchCommand(Bukkit.getConsoleSender(), string); | |
| 57 | } | |
| 58 | } | |
| 59 | ||
| 60 | @Override | |
| 61 | public boolean isIn(Player player) { | |
| 62 | // first prestige does not have a rank | |
| 63 | boolean inFrom = plugin.getPermissions().inGroup(player.getUniqueId(), from); | |
| 64 |
2
1. isIn : negated conditional → SURVIVED 2. isIn : negated conditional → KILLED |
if (rank == null && inFrom) { |
| 65 | // not in any other prestiges | |
| 66 | for (Prestige prestige : plugin.getPrestiges().getTree()) { | |
| 67 |
2
1. isIn : negated conditional → NO_COVERAGE 2. isIn : negated conditional → NO_COVERAGE |
if (prestige != this && prestige.isIn(player)) { |
| 68 |
1
1. isIn : replaced boolean return with true for sh/okx/rankup/prestige/Prestige::isIn → NO_COVERAGE |
return false; |
| 69 | } | |
| 70 | } | |
| 71 |
1
1. isIn : replaced boolean return with false for sh/okx/rankup/prestige/Prestige::isIn → NO_COVERAGE |
return true; |
| 72 | } | |
| 73 | ||
| 74 |
1
1. isIn : negated conditional → KILLED |
if (rank == null) { |
| 75 |
1
1. isIn : replaced boolean return with true for sh/okx/rankup/prestige/Prestige::isIn → KILLED |
return false; |
| 76 | } | |
| 77 | ||
| 78 | // subsequent prestiges | |
| 79 | boolean inRank = plugin.getPermissions().inGroup(player.getUniqueId(), rank); | |
| 80 |
1
1. isIn : negated conditional → KILLED |
if (inRank) { |
| 81 |
1
1. isIn : replaced boolean return with false for sh/okx/rankup/prestige/Prestige::isIn → NO_COVERAGE |
return true; |
| 82 | } | |
| 83 | ||
| 84 |
1
1. isIn : replaced boolean return with true for sh/okx/rankup/prestige/Prestige::isIn → KILLED |
return false; |
| 85 | } | |
| 86 | ||
| 87 | public boolean isEligible(Player player) { | |
| 88 |
2
1. isEligible : replaced boolean return with false for sh/okx/rankup/prestige/Prestige::isEligible → NO_COVERAGE 2. isEligible : replaced boolean return with true for sh/okx/rankup/prestige/Prestige::isEligible → NO_COVERAGE |
return plugin.getPermissions().inGroup(player.getUniqueId(), from); |
| 89 | } | |
| 90 | } | |
Mutations | ||
| 18 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 10.10 11.11 12.12 13.13 14.14 15.15 16.16 17.17 18.18 19.19 20.20 21.21 22.22 23.23 24.24 25.25 26.26 |
|
| 19 |
1.1 |
|
| 21 |
1.1 |
|
| 23 |
1.1 |
|
| 36 |
1.1 |
|
| 53 |
1.1 |
|
| 64 |
1.1 2.2 |
|
| 67 |
1.1 2.2 |
|
| 68 |
1.1 |
|
| 71 |
1.1 |
|
| 74 |
1.1 |
|
| 75 |
1.1 |
|
| 80 |
1.1 |
|
| 81 |
1.1 |
|
| 84 |
1.1 |
|
| 88 |
1.1 2.2 |