More translation stuff

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1400 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-05-09 21:45:35 +00:00
parent 7b066c0468
commit 5f803ffcaa
4 changed files with 64 additions and 48 deletions

View File

@ -47,7 +47,7 @@ public class EssentialsEcoPlayerListener extends PlayerListener
double cost = Double.parseDouble(sign.getLine(3).substring(1)); double cost = Double.parseDouble(sign.getLine(3).substring(1));
if (user.getMoney() < cost) if (user.getMoney() < cost)
{ {
throw new Exception("You do not have sufficient funds."); throw new Exception(Util.i18n("notEnoughMoney"));
} }
user.takeMoney(cost); user.takeMoney(cost);
Map<Integer, ItemStack> leftOver = user.getInventory().addItem(item); Map<Integer, ItemStack> leftOver = user.getInventory().addItem(item);
@ -59,7 +59,7 @@ public class EssentialsEcoPlayerListener extends PlayerListener
} }
catch (Throwable ex) catch (Throwable ex)
{ {
user.sendMessage("§cError: " + ex.getMessage()); user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
} }
return; return;
} }
@ -73,7 +73,7 @@ public class EssentialsEcoPlayerListener extends PlayerListener
double cost = Double.parseDouble(sign.getLine(3).substring(1)); double cost = Double.parseDouble(sign.getLine(3).substring(1));
if (!InventoryWorkaround.containsItem(user.getInventory(), true, item)) if (!InventoryWorkaround.containsItem(user.getInventory(), true, item))
{ {
throw new Exception("You do not have enough items to sell."); throw new Exception(Util.format("missingItems", amount, sign.getLine(2)));
} }
user.giveMoney(cost); user.giveMoney(cost);
InventoryWorkaround.removeItem(user.getInventory(), true, item); InventoryWorkaround.removeItem(user.getInventory(), true, item);
@ -81,7 +81,7 @@ public class EssentialsEcoPlayerListener extends PlayerListener
} }
catch (Throwable ex) catch (Throwable ex)
{ {
user.sendMessage("§cError: " + ex.getMessage()); user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
} }
return; return;
} }
@ -102,7 +102,7 @@ public class EssentialsEcoPlayerListener extends PlayerListener
r2 = m2 ? r2 : r2 - r2 % q2; r2 = m2 ? r2 : r2 - r2 % q2;
if ((!m1 & q1 < 1) || (!m2 & q2 < 1)) if ((!m1 & q1 < 1) || (!m2 & q2 < 1))
{ {
throw new Exception("Quantities must be greater than 0."); throw new Exception(Util.i18n("moreThanZero"));
} }
ItemStack i1 = m1 || r1 <= 0 ? null : ItemDb.get(l1[1], (int)r1); ItemStack i1 = m1 || r1 <= 0 ? null : ItemDb.get(l1[1], (int)r1);
@ -134,20 +134,20 @@ public class EssentialsEcoPlayerListener extends PlayerListener
{ {
if (user.getMoney() < q1) if (user.getMoney() < q1)
{ {
throw new Exception("You do not have sufficient funds."); throw new Exception(Util.i18n("notEnoughMoney"));
} }
} }
else else
{ {
if (!InventoryWorkaround.containsItem(user.getInventory(), true, qi1)) if (!InventoryWorkaround.containsItem(user.getInventory(), true, qi1))
{ {
throw new Exception("You do not have " + String.valueOf((int)q1) + "x " + l1[1] + "."); throw new Exception(Util.format("missingItems", (int)q1, l1[1]));
} }
} }
if (r2 < q2) if (r2 < q2)
{ {
throw new Exception("The trade sign does not have enough supply left."); throw new Exception(Util.i18n("tradeSignEmpty"));
} }
if (m1) if (m1)
@ -182,12 +182,12 @@ public class EssentialsEcoPlayerListener extends PlayerListener
sign.setLine(1, (m1 ? Util.formatCurrency(q1) : String.format("%.0f", q1) + " " + l1[1]) + ":" + String.format((m1 ? "%.2f" : "%.0f"), Util.roundDouble(r1))); sign.setLine(1, (m1 ? Util.formatCurrency(q1) : String.format("%.0f", q1) + " " + l1[1]) + ":" + String.format((m1 ? "%.2f" : "%.0f"), Util.roundDouble(r1)));
sign.setLine(2, (m2 ? Util.formatCurrency(q2) : String.format("%.0f", q2) + " " + l2[1]) + ":" + String.format((m2 ? "%.2f" : "%.0f"), Util.roundDouble(r2))); sign.setLine(2, (m2 ? Util.formatCurrency(q2) : String.format("%.0f", q2) + " " + l2[1]) + ":" + String.format((m2 ? "%.2f" : "%.0f"), Util.roundDouble(r2)));
sign.update(); sign.update();
user.sendMessage("§7Trade completed."); user.sendMessage(Util.i18n("tradeCompleted"));
} }
} }
catch (Throwable ex) catch (Throwable ex)
{ {
user.sendMessage("§cError: " + ex.getMessage()); user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
} }
return; return;
} }

View File

@ -1,6 +1,5 @@
package com.earth2me.essentials; package com.earth2me.essentials;
import org.bukkit.Server;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -76,7 +75,7 @@ public class EssentialsEntityListener extends EntityListener
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back")) if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
{ {
user.setLastLocation(); user.setLastLocation();
user.sendMessage("§7Use the /back command to return to your death point"); user.sendMessage(Util.i18n("backAfterDeath"));
} }
} }
} }

View File

@ -54,7 +54,7 @@ public class EssentialsPlayerListener extends PlayerListener
if (user.isMuted()) if (user.isMuted())
{ {
event.setCancelled(true); event.setCancelled(true);
logger.info(user.getName() + " tried to speak, but is muted."); logger.info(Util.format("mutedUserSpeaks", user.getName()));
} }
} }
@ -136,15 +136,15 @@ public class EssentialsPlayerListener extends PlayerListener
if (world.getEnvironment() == World.Environment.NETHER || ess.getSettings().getGenerateExitPortals()) if (world.getEnvironment() == World.Environment.NETHER || ess.getSettings().getGenerateExitPortals())
{ {
portal = NetherPortal.createPortal(dest); portal = NetherPortal.createPortal(dest);
logger.info(event.getPlayer().getName() + " used a portal and generated an exit portal."); logger.info(Util.format("userCreatedPortal ", event.getPlayer().getName()));
user.sendMessage("§7Generating an exit portal."); user.sendMessage(Util.i18n("generatingPortal"));
loc = portal.getSpawn(); loc = portal.getSpawn();
} }
} }
else else
{ {
logger.info(event.getPlayer().getName() + " used a portal and used an existing exit portal."); logger.info(Util.format("userUsedPortal", event.getPlayer().getName()));
user.sendMessage("§7Teleporting via portal to an existing portal."); user.sendMessage(Util.i18n("usingPortal"));
loc = portal.getSpawn(); loc = portal.getSpawn();
} }
@ -159,7 +159,7 @@ public class EssentialsPlayerListener extends PlayerListener
user.sendMessage(ex.getMessage()); user.sendMessage(ex.getMessage());
} }
user.setJustPortaled(true); user.setJustPortaled(true);
user.sendMessage("§7Teleporting via portal."); user.sendMessage(Util.i18n("teleportingPortal"));
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -185,7 +185,6 @@ public class EssentialsPlayerListener extends PlayerListener
user.dispose(); user.dispose();
Thread thread = new Thread(new Runnable() Thread thread = new Thread(new Runnable()
{ {
@SuppressWarnings("LoggerStringConcat")
public void run() public void run()
{ {
try try
@ -197,7 +196,7 @@ public class EssentialsPlayerListener extends PlayerListener
rt.gc(); rt.gc();
mem = rt.freeMemory() - mem; mem = rt.freeMemory() - mem;
mem /= 1024 * 1024; mem /= 1024 * 1024;
logger.info("Freed " + mem + " MB."); logger.log(Level.INFO, Util.format("freedMemory", mem));
} }
catch (InterruptedException ex) catch (InterruptedException ex)
{ {
@ -219,7 +218,7 @@ public class EssentialsPlayerListener extends PlayerListener
if (user.isIpBanned()) if (user.isIpBanned())
{ {
String banReason = user.getBanReason(); String banReason = user.getBanReason();
user.kickPlayer(banReason != null && !banReason.isEmpty() ? banReason : "The Ban Hammer has spoken!"); user.kickPlayer(banReason != null && !banReason.isEmpty() ? banReason : Util.i18n("defaultBanReason"));
return; return;
} }
@ -242,11 +241,11 @@ public class EssentialsPlayerListener extends PlayerListener
List<String> mail = user.getMails(); List<String> mail = user.getMails();
if (mail.isEmpty()) if (mail.isEmpty())
{ {
user.sendMessage("§7You have no new mail."); user.sendMessage(Util.i18n("noNewMail"));
} }
else else
{ {
user.sendMessage("§cYou have " + mail.size() + " messages!§f Type §7/mail read§f to view your mail."); user.sendMessage(Util.format("youHaveNewMail", mail.size()));
} }
} }
} }
@ -263,13 +262,13 @@ public class EssentialsPlayerListener extends PlayerListener
if (user.isBanned()) if (user.isBanned())
{ {
String banReason = user.getBanReason(); String banReason = user.getBanReason();
event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() ? banReason : "The Ban Hammer has spoken!"); event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() ? banReason : Util.i18n("defaultBanReason"));
return; return;
} }
if (server.getOnlinePlayers().length >= server.getMaxPlayers() && !user.isAuthorized("essentials.joinfullserver")) if (server.getOnlinePlayers().length >= server.getMaxPlayers() && !user.isAuthorized("essentials.joinfullserver"))
{ {
event.disallow(Result.KICK_FULL, "Server is full"); event.disallow(Result.KICK_FULL, Util.i18n("serverFull"));
return; return;
} }
@ -306,9 +305,9 @@ public class EssentialsPlayerListener extends PlayerListener
} }
catch (Exception ex) catch (Exception ex)
{ {
logger.log(Level.WARNING, "Error occured when trying to return player to jail.", ex); logger.log(Level.WARNING, Util.i18n("returnPlayerToJailError"), ex);
} }
user.sendMessage(ChatColor.RED + "You do the crime, you do the time."); user.sendMessage(Util.i18n("jailMessage"));
} }
@Override @Override
@ -335,7 +334,7 @@ public class EssentialsPlayerListener extends PlayerListener
if (essBlockListener.isBlockProtected(event.getClickedBlock(), user)) if (essBlockListener.isBlockProtected(event.getClickedBlock(), user))
{ {
event.setCancelled(true); event.setCancelled(true);
user.sendMessage("§cYou do not have permission to access that chest."); user.sendMessage(Util.format("noAccessPermission", event.getClickedBlock().getType().toString().toLowerCase()));
return; return;
} }
} }
@ -346,7 +345,7 @@ public class EssentialsPlayerListener extends PlayerListener
try try
{ {
user.setHome(); user.setHome();
user.sendMessage("§7Your home is now set to this bed."); user.sendMessage(Util.i18n("homeSetToBed"));
} }
catch (Throwable ex) catch (Throwable ex)
{ {
@ -392,30 +391,30 @@ public class EssentialsPlayerListener extends PlayerListener
int q1 = Integer.parseInt(m1 ? l1[0].substring(1) : l1[0]); int q1 = Integer.parseInt(m1 ? l1[0].substring(1) : l1[0]);
if (q1 < 1) if (q1 < 1)
{ {
throw new Exception("Quantities must be greater than 0."); throw new Exception(Util.i18n("moreThanZero"));
} }
if (m1) if (m1)
{ {
if (user.getMoney() < q1) if (user.getMoney() < q1)
{ {
throw new Exception("You do not have sufficient funds."); throw new Exception(Util.i18n("notEnoughMoney"));
} }
user.takeMoney(q1); user.takeMoney(q1);
user.sendMessage("$" + q1 + " taken from your bank account."); user.sendMessage(Util.format("moneyTaken", Util.formatCurrency(q1)));
} }
else else
{ {
ItemStack i = ItemDb.get(l1[1], q1); ItemStack i = ItemDb.get(l1[1], q1);
if (!InventoryWorkaround.containsItem(user.getInventory(), true, i)) if (!InventoryWorkaround.containsItem(user.getInventory(), true, i))
{ {
throw new Exception("You do not have " + q1 + "x " + l1[1] + "."); throw new Exception(Util.format("missingItems", q1, l1[1]));
} }
InventoryWorkaround.removeItem(user.getInventory(), true, i); InventoryWorkaround.removeItem(user.getInventory(), true, i);
user.updateInventory(); user.updateInventory();
} }
} }
user.setHealth(20); user.setHealth(20);
user.sendMessage("§7You have been healed."); user.sendMessage(Util.i18n("youAreHealed"));
return; return;
} }
if (sign.getLine(0).equals("§1[Mail]") && user.isAuthorized("essentials.signs.mail.use") && user.isAuthorized("essentials.mail")) if (sign.getLine(0).equals("§1[Mail]") && user.isAuthorized("essentials.signs.mail.use") && user.isAuthorized("essentials.mail"))
@ -423,19 +422,19 @@ public class EssentialsPlayerListener extends PlayerListener
List<String> mail = user.getMails(); List<String> mail = user.getMails();
if (mail.isEmpty()) if (mail.isEmpty())
{ {
user.sendMessage("§cYou do not have any mail!"); user.sendMessage(Util.i18n("noNewMail"));
return; return;
} }
for (String s : mail) for (String s : mail)
{ {
user.sendMessage(s); user.sendMessage(s);
} }
user.sendMessage("§cTo mark your mail as read, type §c/mail clear"); user.sendMessage(Util.i18n("markMailAsRead"));
return; return;
} }
if (sign.getLine(0).equals("§1[Balance]") && user.isAuthorized("essentials.signs.balance.use")) if (sign.getLine(0).equals("§1[Balance]") && user.isAuthorized("essentials.signs.balance.use"))
{ {
user.sendMessage("§7Balance: $" + user.getMoney()); user.sendMessage(Util.format("balance", user.getMoney()));
return; return;
} }
if (sign.getLine(0).equals("§1[Warp]")) if (sign.getLine(0).equals("§1[Warp]"))
@ -467,7 +466,7 @@ public class EssentialsPlayerListener extends PlayerListener
} }
catch (Throwable ex) catch (Throwable ex)
{ {
user.sendMessage("§cError: " + ex.getMessage()); user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
} }
} }
@ -480,23 +479,23 @@ public class EssentialsPlayerListener extends PlayerListener
int q1 = Integer.parseInt(m1 ? l1[0].substring(1) : l1[0]); int q1 = Integer.parseInt(m1 ? l1[0].substring(1) : l1[0]);
if (q1 < 1) if (q1 < 1)
{ {
throw new Exception("Quantities must be greater than 0."); throw new Exception(Util.i18n("moreThanZero"));
} }
if (m1) if (m1)
{ {
if (user.getMoney() < q1) if (user.getMoney() < q1)
{ {
throw new Exception("You do not have sufficient funds."); throw new Exception(Util.i18n("notEnoughMoney"));
} }
user.takeMoney(q1); user.takeMoney(q1);
user.sendMessage("$" + q1 + " taken from your bank account."); user.sendMessage(Util.format("moneyTaken", Util.formatCurrency(q1)));
} }
else else
{ {
ItemStack i = ItemDb.get(l1[1], q1); ItemStack i = ItemDb.get(l1[1], q1);
if (!InventoryWorkaround.containsItem(user.getInventory(), true, i)) if (!InventoryWorkaround.containsItem(user.getInventory(), true, i))
{ {
throw new Exception("You do not have " + q1 + "x " + l1[1] + "."); throw new Exception(Util.format("missingItems", q1, l1[1]));
} }
InventoryWorkaround.removeItem(user.getInventory(), true, i); InventoryWorkaround.removeItem(user.getInventory(), true, i);
user.updateInventory(); user.updateInventory();

View File

@ -25,6 +25,7 @@ bannedPlayersFileError = Error reading banned-players.txt
bannedIpsFileNotFound = banned-ips.txt not found bannedIpsFileNotFound = banned-ips.txt not found
bannedIpsFileError = Error reading banned-ips.txt bannedIpsFileError = Error reading banned-ips.txt
noDestroyPermission = \u00a7cYou do not have permission to destroy that {0}. noDestroyPermission = \u00a7cYou do not have permission to destroy that {0}.
noAccessPermission = \u00a7cYou do not have permission to access that {0}.
moreThanZero = Quantities must be greater than 0. moreThanZero = Quantities must be greater than 0.
errorWithMessage = \u00a7cError: {0} errorWithMessage = \u00a7cError: {0}
creatingConfigFromTemplate = Creating config from template: {0} creatingConfigFromTemplate = Creating config from template: {0}
@ -35,12 +36,29 @@ failedToWriteConfig = Failed to write config {0}
failedToCloseConfig = Failed to close config {0} failedToCloseConfig = Failed to close config {0}
notEnoughMoney = You do not have sufficient funds. notEnoughMoney = You do not have sufficient funds.
missingItems = You do not have {0}x {1}. missingItems = You do not have {0}x {1}.
errorWithMessage = \u00a7cError: {0} tradeSignEmpty = The trade sign does not have enough supply left.
tradeCompleted = \u00a77Trade completed.
backAfterDeath = \u00a77Use the /back command to return to your death point.
mutedUserSpeaks = {0} tried to speak, but is muted.
userCreatedPortal = {0} used a portal and generated an exit portal.
generatingPortal = \u00a77Generating an exit portal.
userUsedPortal = {0} used an existing exit portal.
usingPortal = \u00a77Teleporting via portal to an existing portal.
teleportingPortal = \u00a77Teleporting via portal.
freedMemory = Freed {0} MB.
defaultBanReason = The Ban Hammer has spoken!
noNewMail = \u00a77You have no new mail.
serverFull = Server is full
returnPlayerToJailError = Error occured when trying to return player to jail.
jailMessage = \u00a7cYou do the crime, you do the time.
homeSetToBed = \u00a77Your home is now set to this bed.
moneyTaken = {0} taken from your bank account.
youAreHealed = \u00a77You have been healed.
markMailAsRead = \u00a7cTo mark your mail as read, type /mail clear
balance = \u00a77Balance: {0}
backUsageMsg = \u00a77Returning to previous location. backUsageMsg = \u00a77Returning to previous location.
balance = \u00a77Balance: {0}. playerBanned = \u00a7cPlayer {0} banned
playerBanned = \u00a7cPlayer {0} banned. banIpAddress = \u00a77Banned IP address
defaultBanReason = Banned from server.
banIpAddress = \u00a77Banned IP address.
bigTreeSuccess = \u00a77Big tree spawned. bigTreeSuccess = \u00a77Big tree spawned.
bigTreeFailure = \u00a7cBig tree generation failure. Try again on grass or dirt. bigTreeFailure = \u00a7cBig tree generation failure. Try again on grass or dirt.
broadcast = [\u00a7cBroadcast\u00a7f]\u00a7a {0} broadcast = [\u00a7cBroadcast\u00a7f]\u00a7a {0}