From b85a8fefe954802266b6b8efbb09e71f6ec9958f Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 31 Jan 2023 20:16:41 -0800 Subject: [PATCH] feat: Make power level display for offline players Fixes #4599 --- .../gmail/nossr50/commands/player/InspectCommand.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/player/InspectCommand.java b/src/main/java/com/gmail/nossr50/commands/player/InspectCommand.java index f1b93b1af..816656b1f 100644 --- a/src/main/java/com/gmail/nossr50/commands/player/InspectCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/player/InspectCommand.java @@ -47,21 +47,28 @@ public class InspectCommand implements TabExecutor { sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName)); + // Sum power level + int powerLevel = 0; + sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering")); for (PrimarySkillType skill : mcMMO.p.getSkillTools().GATHERING_SKILLS) { sender.sendMessage(CommandUtils.displaySkill(profile, skill)); + powerLevel += profile.getSkillLevel(skill); } sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat")); for (PrimarySkillType skill : mcMMO.p.getSkillTools().COMBAT_SKILLS) { sender.sendMessage(CommandUtils.displaySkill(profile, skill)); + powerLevel += profile.getSkillLevel(skill); } sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc")); for (PrimarySkillType skill : mcMMO.p.getSkillTools().MISC_SKILLS) { sender.sendMessage(CommandUtils.displaySkill(profile, skill)); + powerLevel += profile.getSkillLevel(skill); } + sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", powerLevel)); } else { Player target = mcMMOPlayer.getPlayer(); boolean isVanished = false; @@ -95,9 +102,7 @@ public class InspectCommand implements TabExecutor { CommandUtils.printCombatSkills(target, sender); CommandUtils.printMiscSkills(target, sender); - if (!isVanished) { - sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel())); - } + sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel())); } return true;