Resolving issues #243, #241, and #234.

This commit is contained in:
Glitchfinder 2012-10-30 17:59:58 -07:00
parent 9354831729
commit 70231b6ae0
10 changed files with 67 additions and 0 deletions

View File

@ -51,6 +51,11 @@ public class CommandHelper {
if (Skills.hasGatheringSkills(inspect)) { if (Skills.hasGatheringSkills(inspect)) {
PlayerProfile profile = Users.getProfile(inspect); PlayerProfile profile = Users.getProfile(inspect);
if (profile == null) {
display.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return;
}
display.sendMessage(LocaleLoader.getString("Stats.Header.Gathering")); display.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
if (Permissions.getInstance().excavation(inspect)) { if (Permissions.getInstance().excavation(inspect)) {
@ -89,6 +94,11 @@ public class CommandHelper {
if (Skills.hasCombatSkills(inspect)) { if (Skills.hasCombatSkills(inspect)) {
PlayerProfile profile = Users.getProfile(inspect); PlayerProfile profile = Users.getProfile(inspect);
if (profile == null) {
display.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return;
}
display.sendMessage(LocaleLoader.getString("Stats.Header.Combat")); display.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
if (Permissions.getInstance().axes(inspect)) { if (Permissions.getInstance().axes(inspect)) {
@ -126,6 +136,12 @@ public class CommandHelper {
public static void printMiscSkills(Player inspect, CommandSender display) { public static void printMiscSkills(Player inspect, CommandSender display) {
if (Skills.hasMiscSkills(inspect)) { if (Skills.hasMiscSkills(inspect)) {
PlayerProfile profile = Users.getProfile(inspect); PlayerProfile profile = Users.getProfile(inspect);
if (profile == null) {
display.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return;
}
display.sendMessage(LocaleLoader.getString("Stats.Header.Misc")); display.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
if (Permissions.getInstance().acrobatics(inspect)) { if (Permissions.getInstance().acrobatics(inspect)) {

View File

@ -46,6 +46,11 @@ public abstract class SkillCommand implements CommandExecutor {
player = (Player) sender; player = (Player) sender;
profile = Users.getProfile(player); profile = Users.getProfile(player);
if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
skillValue = profile.getSkillLevel(skill); skillValue = profile.getSkillLevel(skill);
dataCalculations(); dataCalculations();
permissionsCheck(); permissionsCheck();

View File

@ -72,6 +72,11 @@ public class AddlevelsCommand implements CommandExecutor{
String playerName = modifiedPlayer.getName(); String playerName = modifiedPlayer.getName();
profile = Users.getProfile(modifiedPlayer); profile = Users.getProfile(modifiedPlayer);
if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (!profile.isLoaded()) { if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist")); sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true; return true;

View File

@ -85,6 +85,11 @@ public class AddxpCommand implements CommandExecutor {
McMMOPlayer mcMMOPlayer = Users.getPlayer(modifiedPlayer); McMMOPlayer mcMMOPlayer = Users.getPlayer(modifiedPlayer);
PlayerProfile profile = Users.getProfile(modifiedPlayer); PlayerProfile profile = Users.getProfile(modifiedPlayer);
if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (!profile.isLoaded()) { if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist")); sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true; return true;

View File

@ -51,6 +51,11 @@ public class InspectCommand implements CommandExecutor {
PlayerProfile profile = new PlayerProfile(args[0], false); //Temporary Profile PlayerProfile profile = new PlayerProfile(args[0], false); //Temporary Profile
if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (!profile.isLoaded()) { if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist")); sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true; return true;

View File

@ -88,6 +88,11 @@ public class MmoeditCommand implements CommandExecutor {
if (mcmmoPlayer != null) { if (mcmmoPlayer != null) {
profile = mcmmoPlayer.getProfile(); profile = mcmmoPlayer.getProfile();
if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
profile.modifySkill(skill, newValue); profile.modifySkill(skill, newValue);
mcmmoPlayer.getPlayer().sendMessage(ChatColor.GREEN + "Your level in " + skillName + " was set to " + newValue + "!"); //TODO: Needs more locale. mcmmoPlayer.getPlayer().sendMessage(ChatColor.GREEN + "Your level in " + skillName + " was set to " + newValue + "!"); //TODO: Needs more locale.
sender.sendMessage(ChatColor.RED + skillName + " has been modified for " + args[0] + "."); //TODO: Use locale sender.sendMessage(ChatColor.RED + skillName + " has been modified for " + args[0] + "."); //TODO: Use locale
@ -95,6 +100,11 @@ public class MmoeditCommand implements CommandExecutor {
else { else {
profile = new PlayerProfile(args[0], false); //Temporary Profile profile = new PlayerProfile(args[0], false); //Temporary Profile
if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (!profile.isLoaded()) { if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist")); sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true; return true;

View File

@ -45,6 +45,12 @@ public class SkillResetCommand implements CommandExecutor {
//reset the values in the hash table and persist them //reset the values in the hash table and persist them
PlayerProfile profile = Users.getProfile((Player)sender); PlayerProfile profile = Users.getProfile((Player)sender);
if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
profile.resetSkill(skillType); profile.resetSkill(skillType);
profile.save(); profile.save();

View File

@ -24,6 +24,11 @@ public class McabilityCommand implements CommandExecutor {
PlayerProfile profile = Users.getProfile((Player) sender); PlayerProfile profile = Users.getProfile((Player) sender);
if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (profile.getAbilityUse()) { if (profile.getAbilityUse()) {
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Off")); sender.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
} }

View File

@ -24,6 +24,11 @@ public class McgodCommand implements CommandExecutor {
PlayerProfile profile = Users.getProfile((Player) sender); PlayerProfile profile = Users.getProfile((Player) sender);
if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (profile.getGodMode()) { if (profile.getGodMode()) {
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled")); sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
} }

View File

@ -47,6 +47,11 @@ public class McrefreshCommand implements CommandExecutor {
profile = Users.getProfile(player); profile = Users.getProfile(player);
String playerName = player.getName(); String playerName = player.getName();
if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
if (!profile.isLoaded()) { if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist")); sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true; return true;