From 89da8b832f5f6db0297fd0851562dfb2c8604bd0 Mon Sep 17 00:00:00 2001 From: GJ Date: Wed, 16 Jan 2013 22:13:30 -0500 Subject: [PATCH] Localize chat commands and /invite --- .../java/com/gmail/nossr50/commands/party/ACommand.java | 7 +++---- .../com/gmail/nossr50/commands/party/InviteCommand.java | 3 +-- .../java/com/gmail/nossr50/commands/party/PCommand.java | 7 +++---- src/main/resources/locale/locale_en_US.properties | 4 ++++ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/party/ACommand.java b/src/main/java/com/gmail/nossr50/commands/party/ACommand.java index cb4bf9eba..4a725a8c2 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/ACommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/ACommand.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.commands.party; -import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -24,7 +23,7 @@ public class ACommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { PlayerProfile profile; - String usage = ChatColor.RED + "Proper usage is /a "; //TODO: Needs more locale. + String usage = LocaleLoader.getString("Commands.Usage.1", new Object[] {"a", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">"}); if (CommandHelper.noCommandPermissions(sender, "mcmmo.chat.adminchat")) { return true; @@ -76,7 +75,7 @@ public class ACommand implements CommandExecutor { } message = chatEvent.getMessage(); - String prefix = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} "; + String prefix = LocaleLoader.getString("Commands.AdminChat.Prefix", new Object[] {player.getName()} ); plugin.getLogger().info("[A]<" + player.getName() + "> " + message); @@ -95,7 +94,7 @@ public class ACommand implements CommandExecutor { } message = chatEvent.getMessage(); - String prefix = ChatColor.AQUA + "{" + ChatColor.WHITE + "*Console*" + ChatColor.AQUA + "} "; + String prefix = LocaleLoader.getString("Commands.AdminChat.Prefix", new Object[] {LocaleLoader.getString("Commands.Chat.Console")} ); plugin.getLogger().info("[A]<*Console*> " + message); diff --git a/src/main/java/com/gmail/nossr50/commands/party/InviteCommand.java b/src/main/java/com/gmail/nossr50/commands/party/InviteCommand.java index 86f34682a..4bd1d5faf 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/InviteCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/InviteCommand.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.commands.party; -import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -24,7 +23,7 @@ public class InviteCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - String usage = ChatColor.RED + "Proper usage is /invite "; //TODO: Needs more locale. + String usage = LocaleLoader.getString("Commands.Usage.1", new Object[] {"invite", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"}); if (CommandHelper.noConsoleUsage(sender)) { return true; diff --git a/src/main/java/com/gmail/nossr50/commands/party/PCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PCommand.java index 5906fc209..2e7f11189 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PCommand.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.commands.party; -import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -25,7 +24,7 @@ public class PCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { PlayerProfile profile; - String usage = ChatColor.RED + "Proper usage is /p "; //TODO: Needs more locale. + String usage = LocaleLoader.getString("Commands.Usage.2", new Object[] {"p", "<" + LocaleLoader.getString("Commands.Usage.PartyName") + ">", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">"}); if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) { return true; @@ -83,7 +82,7 @@ public class PCommand implements CommandExecutor { } message = chatEvent.getMessage(); - String prefix = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") "; + String prefix = LocaleLoader.getString("Commands.Party.Chat.Prefix", new Object[] {player.getName()} ); plugin.getLogger().info("[P](" + party.getName() + ")" + "<" + player.getName() + "> " + message); @@ -120,7 +119,7 @@ public class PCommand implements CommandExecutor { } message = chatEvent.getMessage(); - String prefix = ChatColor.GREEN + "(" + ChatColor.WHITE + "*Console*" + ChatColor.GREEN + ") "; + String prefix = LocaleLoader.getString("Commands.Party.Chat.Prefix", new Object[] {LocaleLoader.getString("Commands.Chat.Console")} ); plugin.getLogger().info("[P](" + args[0] + ")" + "<*Console*> " + message); diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 0f4a3d062..8cff8f14d 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -392,6 +392,7 @@ Commands.AdminChat.Off=Admin Chat only [[RED]]Off Commands.AdminChat.On=Admin Chat only [[GREEN]]On Commands.AdminChat.Prefix=[[AQUA]]{[[WHITE]]{0}[[AQUA]]} Commands.AdminToggle=[[RED]]- Toggle admin chat +Commands.Chat.Console=*Console* Commands.Disabled=[[RED]]This command is disabled. Commands.DoesNotExist= [[RED]]Player does not exist in the database! Commands.GodMode.Disabled=[[YELLOW]]mcMMO Godmode Disabled @@ -442,6 +443,9 @@ Commands.Stats.Self=YOUR STATS Commands.Stats=[[RED]]- View your mcMMO stats Commands.ToggleAbility=[[RED]]- Toggle ability activation with right click Commands.Usage.1=[[RED]]Proper usage is /{0} {1} +Commands.Usage.2=[[RED]]Proper usage is /{0} {1} {2} +Commands.Usage.Message=message +Commands.Usage.PartyName=party-name Commands.Usage.Player=player mcMMO.NoInvites=[[RED]]You have no invites at this time mcMMO.NoPermission=[[DARK_RED]]Insufficient permissions.