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 committed by TfT_02
parent 476f426590
commit 44e3e4d1e1
6 changed files with 16 additions and 19 deletions

View File

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

View File

@ -22,7 +22,7 @@ public class ConvertDatabaseCommand implements CommandExecutor {
DatabaseType previousType = DatabaseType.getDatabaseType(args[1]);
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()));
return true;
}
@ -39,17 +39,12 @@ public class ConvertDatabaseCommand implements CommandExecutor {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
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);
}
catch (Throwable t) {
sender.sendMessage("An error occurred during the conversion process."); // TODO: Localize
catch (Throwable e) {
e.printStackTrace();
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
return true;
}
}

View File

@ -189,11 +189,7 @@ public final class PartyManager {
public static Party getParty(Player player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (mcMMOPlayer != null) {
return mcMMOPlayer.getParty();
}
return getPlayerParty(player.getName());
return mcMMOPlayer.getParty();
}
/**

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.Ability.Off=Ability use toggled [[RED]]off
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.On=Admin Chat only [[GREEN]]On
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.Enabled=[[YELLOW]]mcMMO Godmode Enabled
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.Invite.Accepted=[[GREEN]]Invite Accepted. You have joined party {0}
Commands.Invite.Success=[[GREEN]]Invite sent successfully.