Fix child skills counting towards power level in /inspect (#4889)

This commit is contained in:
Warrior 2023-04-23 20:08:06 +02:00 committed by GitHub
parent 684e96ff6b
commit 133a60c4bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.SkillTools;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -47,27 +48,26 @@ public class InspectCommand implements TabExecutor {
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName)); sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
// Sum power level
int powerLevel = 0;
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering")); sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
for (PrimarySkillType skill : mcMMO.p.getSkillTools().GATHERING_SKILLS) { for (PrimarySkillType skill : mcMMO.p.getSkillTools().GATHERING_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill)); sender.sendMessage(CommandUtils.displaySkill(profile, skill));
powerLevel += profile.getSkillLevel(skill);
} }
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat")); sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
for (PrimarySkillType skill : mcMMO.p.getSkillTools().COMBAT_SKILLS) { for (PrimarySkillType skill : mcMMO.p.getSkillTools().COMBAT_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill)); sender.sendMessage(CommandUtils.displaySkill(profile, skill));
powerLevel += profile.getSkillLevel(skill);
} }
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc")); sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
for (PrimarySkillType skill : mcMMO.p.getSkillTools().MISC_SKILLS) { for (PrimarySkillType skill : mcMMO.p.getSkillTools().MISC_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill)); sender.sendMessage(CommandUtils.displaySkill(profile, skill));
powerLevel += profile.getSkillLevel(skill);
} }
// Sum power level
int powerLevel = 0;
for (PrimarySkillType skill : SkillTools.NON_CHILD_SKILLS)
powerLevel += profile.getSkillLevel(skill);
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", powerLevel)); sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", powerLevel));
} else { } else {
Player target = mcMMOPlayer.getPlayer(); Player target = mcMMOPlayer.getPlayer();