Localize several command results

Also don't nullcheck the null-guarded mcMMOPlayer in PartyManager
This commit is contained in:
riking 2013-10-08 21:12:04 -07:00
parent c48b25f8e2
commit 938deb8a3d
6 changed files with 16 additions and 19 deletions

View File

@ -24,6 +24,6 @@ public class McabilityCommand extends ToggleCommand {
@Override @Override
protected void sendSuccessMessage(CommandSender sender) { protected void sendSuccessMessage(CommandSender sender) {
sender.sendMessage("Ability use has been toggled for " + player.getName()); // TODO: Localize sender.sendMessage(LocaleLoader.getString("Commands.Ability.Toggle"));
} }
} }

View File

@ -24,6 +24,6 @@ public class McgodCommand extends ToggleCommand {
@Override @Override
protected void sendSuccessMessage(CommandSender sender) { protected void sendSuccessMessage(CommandSender sender) {
sender.sendMessage("God mode has been toggled for " + player.getName()); // TODO: Localize sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Success"));
} }
} }

View File

@ -12,9 +12,9 @@ import org.bukkit.util.StringUtil;
import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
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.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
public class MobhealthCommand implements TabExecutor { public class MobhealthCommand implements TabExecutor {
@ -44,11 +44,11 @@ public class MobhealthCommand implements TabExecutor {
try { try {
MobHealthbarType type = MobHealthbarType.valueOf(args[0].toUpperCase().trim()); MobHealthbarType type = MobHealthbarType.valueOf(args[0].toUpperCase().trim());
playerProfile.setMobHealthbarType(type); playerProfile.setMobHealthbarType(type);
sender.sendMessage("Display type changed to: " + type); //TODO: Localize sender.sendMessage(LocaleLoader.getString("Commands.Healthbars.Changed." + type.name()));
return true; return true;
} }
catch (IllegalArgumentException ex) { catch (IllegalArgumentException ex) {
sender.sendMessage("Invalid type!"); //TODO: Localize sender.sendMessage(LocaleLoader.getString("Commands.Healthbars.Invalid"));
return true; return true;
} }

View File

@ -22,7 +22,7 @@ public class ConvertDatabaseCommand implements CommandExecutor {
DatabaseType previousType = DatabaseType.getDatabaseType(args[1]); DatabaseType previousType = DatabaseType.getDatabaseType(args[1]);
DatabaseType newType = mcMMO.getDatabaseManager().getDatabaseType(); DatabaseType newType = mcMMO.getDatabaseManager().getDatabaseType();
if ((newType == DatabaseType.CUSTOM && DatabaseManagerFactory.getCustomDatabaseManagerClass().getSimpleName().equalsIgnoreCase(args[1])) || previousType == newType) { if (previousType == newType || (newType == DatabaseType.CUSTOM && DatabaseManagerFactory.getCustomDatabaseManagerClass().getSimpleName().equalsIgnoreCase(args[1]))) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.Same", newType.toString())); sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.Same", newType.toString()));
return true; return true;
} }
@ -39,17 +39,12 @@ public class ConvertDatabaseCommand implements CommandExecutor {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1])); sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
return true; return true;
} }
}
catch (Exception e) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
return true;
}
try {
oldDatabase = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz); oldDatabase = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz);
} }
catch (Throwable t) { catch (Throwable e) {
sender.sendMessage("An error occurred during the conversion process."); // TODO: Localize e.printStackTrace();
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
return true; return true;
} }
} }

View File

@ -189,13 +189,9 @@ public final class PartyManager {
public static Party getParty(Player player) { public static Party getParty(Player player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (mcMMOPlayer != null) {
return mcMMOPlayer.getParty(); return mcMMOPlayer.getParty();
} }
return getPlayerParty(player.getName());
}
/** /**
* Get a list of all current parties. * Get a list of all current parties.
* *

View File

@ -417,6 +417,7 @@ Commands.addxp.AwardAll=[[GREEN]]You were awarded {0} experience in all skills!
Commands.addxp.AwardSkill=[[GREEN]]You were awarded {0} experience in {1}! Commands.addxp.AwardSkill=[[GREEN]]You were awarded {0} experience in {1}!
Commands.Ability.Off=Ability use toggled [[RED]]off Commands.Ability.Off=Ability use toggled [[RED]]off
Commands.Ability.On=Ability use toggled [[GREEN]]on Commands.Ability.On=Ability use toggled [[GREEN]]on
Commands.Ability.Toggle=Ability use has been toggled for [[YELLOW]]{0}
Commands.AdminChat.Off=Admin Chat only [[RED]]Off Commands.AdminChat.Off=Admin Chat only [[RED]]Off
Commands.AdminChat.On=Admin Chat only [[GREEN]]On Commands.AdminChat.On=Admin Chat only [[GREEN]]On
Commands.AdminToggle=[[RED]]- Toggle admin chat Commands.AdminToggle=[[RED]]- Toggle admin chat
@ -426,6 +427,11 @@ Commands.DoesNotExist= [[RED]]Player does not exist in the database!
Commands.GodMode.Disabled=[[YELLOW]]mcMMO Godmode Disabled Commands.GodMode.Disabled=[[YELLOW]]mcMMO Godmode Disabled
Commands.GodMode.Enabled=[[YELLOW]]mcMMO Godmode Enabled Commands.GodMode.Enabled=[[YELLOW]]mcMMO Godmode Enabled
Commands.GodMode.Forbidden=[mcMMO] God Mode not permitted on this world (See Permissions) Commands.GodMode.Forbidden=[mcMMO] God Mode not permitted on this world (See Permissions)
Commands.GodMode.Toggle=God mode has been toggled for [[YELLOW]]{0}
Commands.Healthbars.Changed.HEARTS=[mcMMO] Your healthbar display type was changed to [[RED]]Hearts[[WHITE]].
Commands.Healthbars.Changed.BAR=[mcMMO] Your healthbar display type was changed to [[YELLOW]]Boxes[[WHITE]].
Commands.Healthbars.Changed.DISABLED=[mcMMO] Your mob healthbars have been [[GRAY]]disabled[[WHITE]].
Commands.Healthbars.Invalid=Invalid healthbar type!
Commands.Inspect=<player> [[RED]]- View detailed player info Commands.Inspect=<player> [[RED]]- View detailed player info
Commands.Invite.Accepted=[[GREEN]]Invite Accepted. You have joined party {0} Commands.Invite.Accepted=[[GREEN]]Invite Accepted. You have joined party {0}
Commands.Invite.Success=[[GREEN]]Invite sent successfully. Commands.Invite.Success=[[GREEN]]Invite sent successfully.