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.config.Config;
import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
@ -18,12 +19,11 @@ public class McstatsCommand implements CommandExecutor {
return true;
}
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mcstats")) {
return true;
}
switch (args.length) {
case 0:
Player player = (Player) sender;
PlayerProfile profile = Users.getPlayer(player).getProfile();
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
PlayerProfile profile = mcMMOPlayer.getProfile();
player.sendMessage(LocaleLoader.getString("Stats.Own.Stats"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
@ -34,13 +34,17 @@ public class McstatsCommand implements CommandExecutor {
int powerLevelCap = Config.getInstance().getPowerLevelCap();
if (powerLevelCap > 0) {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", String.valueOf(Users.getPlayer(player).getPowerLevel()), String.valueOf(powerLevelCap)));
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(Users.getPlayer(player).getPowerLevel())));
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", String.valueOf(mcMMOPlayer.getPowerLevel())));
}
return true;
default:
return false;
}
}
}