Fix issue with /mcstats displaying Integer.MAX_VALUE for the power level

cap when there is no power level cap.
This commit is contained in:
GJ 2013-02-05 09:26:10 -05:00
parent 9af470536b
commit 81ba0404b2

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
@ -18,29 +19,32 @@ public class McstatsCommand implements CommandExecutor {
return true; return true;
} }
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mcstats")) { switch (args.length) {
case 0:
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
PlayerProfile profile = mcMMOPlayer.getProfile();
player.sendMessage(LocaleLoader.getString("Stats.Own.Stats"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
CommandHelper.printGatheringSkills(player, profile);
CommandHelper.printCombatSkills(player, profile);
CommandHelper.printMiscSkills(player, profile);
int powerLevelCap = Config.getInstance().getPowerLevelCap();
if (powerLevelCap != Integer.MAX_VALUE) {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", String.valueOf(mcMMOPlayer.getPowerLevel()), String.valueOf(powerLevelCap)));
}
else {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", String.valueOf(mcMMOPlayer.getPowerLevel())));
}
return true; return true;
default:
return false;
} }
Player player = (Player) sender;
PlayerProfile profile = Users.getPlayer(player).getProfile();
player.sendMessage(LocaleLoader.getString("Stats.Own.Stats"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
CommandHelper.printGatheringSkills(player, profile);
CommandHelper.printCombatSkills(player, profile);
CommandHelper.printMiscSkills(player, profile);
int powerLevelCap = Config.getInstance().getPowerLevelCap();
if (powerLevelCap > 0) {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", String.valueOf(Users.getPlayer(player).getPowerLevel()), String.valueOf(powerLevelCap)));
}
else {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", String.valueOf(Users.getPlayer(player).getPowerLevel())));
}
return true;
} }
} }