From 0671150c4255565eb1168780d84a2ef68a3df023 Mon Sep 17 00:00:00 2001 From: snowleo Date: Tue, 10 May 2011 19:02:59 +0000 Subject: More translation stuff. Essentials namespace is now translated. git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1407 e251c2fe-e539-e718-e476-b85c1f46cddb --- .../com/earth2me/essentials/EssentialsTimer.java | 4 +- .../com/earth2me/essentials/EssentialsUpgrade.java | 16 +-- Essentials/src/com/earth2me/essentials/ItemDb.java | 7 +- Essentials/src/com/earth2me/essentials/Jail.java | 2 +- Essentials/src/com/earth2me/essentials/Mob.java | 2 +- .../src/com/earth2me/essentials/NetherPortal.java | 2 +- .../src/com/earth2me/essentials/OfflinePlayer.java | 110 ++++++++++----------- .../src/com/earth2me/essentials/Settings.java | 14 +-- .../src/com/earth2me/essentials/Teleport.java | 16 +-- Essentials/src/com/earth2me/essentials/User.java | 16 +-- .../src/com/earth2me/essentials/UserData.java | 2 +- Essentials/src/com/earth2me/essentials/Util.java | 34 ++++--- Essentials/src/com/earth2me/essentials/Warps.java | 8 +- Essentials/src/messages.properties | 50 ++++++++++ 14 files changed, 167 insertions(+), 116 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java index 009a4ffd4..f5f0acf03 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java @@ -48,13 +48,13 @@ public class EssentialsTimer implements Runnable, IConf } if (user.getMuteTimeout() > 0 && user.getMuteTimeout() < currentTime && user.isMuted()) { user.setMuteTimeout(0); - user.sendMessage("§7You can talk again"); + user.sendMessage(Util.i18n("canTalkAgain")); user.setMuted(false); } if (user.getJailTimeout() > 0 && user.getJailTimeout() < currentTime && user.isJailed()) { user.setJailTimeout(0); user.setJailed(false); - user.sendMessage("§7You have been released"); + user.sendMessage(Util.i18n("haveBeenReleased")); user.setJail(null); try { diff --git a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java index 1ec9130a0..708cd1f1e 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java @@ -64,7 +64,7 @@ public class EssentialsUpgrade } catch (Throwable e) { - logger.log(Level.SEVERE, "Error while upgrading the files", e); + logger.log(Level.SEVERE, Util.i18n("upgradingFilesError"), e); } } @@ -114,11 +114,11 @@ public class EssentialsUpgrade { if (!file.renameTo(new File(file.getParentFile(), file.getName().concat("." + System.currentTimeMillis() + ".upgradebackup")))) { - throw new Exception("Failed to move config.yml to backup location."); + throw new Exception(Util.i18n("configFileMoveError")); } if (!tempFile.renameTo(file)) { - throw new Exception("Failed to rename temp file to config.yml"); + throw new Exception(Util.i18n("configFileRenameError")); } } else { tempFile.delete(); @@ -273,7 +273,7 @@ public class EssentialsUpgrade Essentials.getWarps().setWarp(filename.substring(0, filename.length() - 4), loc); if (!listOfFiles[i].renameTo(new File(warpsFolder, filename + ".old"))) { - throw new Exception("Renaming file " + filename + " failed"); + throw new Exception(Util.format("fileRenameError", filename)); } } catch (Exception ex) @@ -319,7 +319,7 @@ public class EssentialsUpgrade Essentials.getWarps().setWarp(name, loc); if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old"))) { - throw new Exception("Renaming warps.txt failed"); + throw new Exception(Util.format("fileRenameError", "warps.txt")); } } } @@ -353,16 +353,16 @@ public class EssentialsUpgrade File tmpFile = new File(listOfFiles[i].getParentFile(), sanitizedFilename + ".tmp"); File newFile = new File(listOfFiles[i].getParentFile(), sanitizedFilename); if (!listOfFiles[i].renameTo(tmpFile)) { - logger.log(Level.WARNING, "Failed to move userdata/"+filename+" to userdata/"+sanitizedFilename+".tmp"); + logger.log(Level.WARNING, Util.format("userdataMoveError", filename, sanitizedFilename)); continue; } if (newFile.exists()) { - logger.log(Level.WARNING, "Duplicated userdata: "+filename+" and "+sanitizedFilename); + logger.log(Level.WARNING, Util.format("duplicatedUserdata", filename, sanitizedFilename)); continue; } if (!tmpFile.renameTo(newFile)) { - logger.log(Level.WARNING, "Failed to move userdata/"+sanitizedFilename+".tmp to userdata/"+sanitizedFilename); + logger.log(Level.WARNING, Util.format("userdataMoveBackError", sanitizedFilename, sanitizedFilename)); } } } diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java index c0c5383ff..b1e39eaea 100644 --- a/Essentials/src/com/earth2me/essentials/ItemDb.java +++ b/Essentials/src/com/earth2me/essentials/ItemDb.java @@ -18,7 +18,6 @@ public class ItemDb private static Map items = new HashMap(); private static Map durabilities = new HashMap(); - @SuppressWarnings("LoggerStringConcat") public static void load(File folder, String fname) throws IOException { folder.mkdirs(); @@ -78,7 +77,7 @@ public class ItemDb } catch (Exception ex) { - logger.warning("Error parsing " + fname + " on line " + i); + logger.warning(Util.format("parseError", fname, i)); } } } @@ -131,14 +130,14 @@ public class ItemDb } else { - throw new Exception("Unknown item name: " + id); + throw new Exception(Util.format("unknownItemName", id)); } } Material mat = Material.getMaterial(itemid); if (mat == null) { - throw new Exception("Unknown item id: " + itemid); + throw new Exception(Util.format("unknownItemId", itemid)); } ItemStack retval = new ItemStack(mat); retval.setAmount(Essentials.getStatic().getSettings().getDefaultStackSize()); diff --git a/Essentials/src/com/earth2me/essentials/Jail.java b/Essentials/src/com/earth2me/essentials/Jail.java index d922ec702..d27593ada 100644 --- a/Essentials/src/com/earth2me/essentials/Jail.java +++ b/Essentials/src/com/earth2me/essentials/Jail.java @@ -33,7 +33,7 @@ public class Jail extends BlockListener implements IConf { if (config.getProperty(jailName.toLowerCase()) == null) { - throw new Exception("That jail does not exist"); + throw new Exception(Util.i18n("jailNotExist")); } Location loc = config.getLocation(jailName.toLowerCase(), Essentials.getStatic().getServer()); diff --git a/Essentials/src/com/earth2me/essentials/Mob.java b/Essentials/src/com/earth2me/essentials/Mob.java index 895fdf886..960f52cca 100644 --- a/Essentials/src/com/earth2me/essentials/Mob.java +++ b/Essentials/src/com/earth2me/essentials/Mob.java @@ -93,7 +93,7 @@ public enum Mob } catch (Exception ex) { - logger.warning("Unable to spawn mob."); + logger.warning(Util.i18n("unableToSpawnMob")); ex.printStackTrace(); throw new MobException(); } diff --git a/Essentials/src/com/earth2me/essentials/NetherPortal.java b/Essentials/src/com/earth2me/essentials/NetherPortal.java index 76d75ddaf..8c8c9e52f 100644 --- a/Essentials/src/com/earth2me/essentials/NetherPortal.java +++ b/Essentials/src/com/earth2me/essentials/NetherPortal.java @@ -120,7 +120,7 @@ public class NetherPortal // For now, don't worry about direction int x = dest.getX(), y = dest.getY(), z = dest.getZ(); - Logger.getLogger("Minecraft").log(Level.INFO, "Creating portal at "+x+","+y+","+z+"."); + Logger.getLogger("Minecraft").log(Level.INFO, Util.format("creatingPortal", x, y, z)); // Clear area around portal ArrayList columns = new ArrayList(); diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index 1fd5b28c9..5d7104914 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -160,22 +160,22 @@ public class OfflinePlayer implements Player public int getRemainingAir() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void setRemainingAir(int i) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public int getMaximumAir() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void setMaximumAir(int i) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public boolean isSneaking() @@ -185,62 +185,62 @@ public class OfflinePlayer implements Player public void setSneaking(boolean bln) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void updateInventory() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void chat(String string) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public double getEyeHeight() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public double getEyeHeight(boolean bln) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public List getLineOfSight(HashSet hs, int i) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public Block getTargetBlock(HashSet hs, int i) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public List getLastTwoTargetBlocks(HashSet hs, int i) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public int getFireTicks() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public int getMaxFireTicks() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void setFireTicks(int i) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void remove() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public Server getServer() @@ -250,195 +250,195 @@ public class OfflinePlayer implements Player public Vector getMomentum() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void setMomentum(Vector vector) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void setVelocity(Vector vector) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public Vector getVelocity() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void damage(int i) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void damage(int i, Entity entity) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public Location getEyeLocation() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void sendRawMessage(String string) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public Location getCompassTarget() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public int getMaximumNoDamageTicks() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void setMaximumNoDamageTicks(int i) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public int getLastDamage() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void setLastDamage(int i) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public int getNoDamageTicks() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void setNoDamageTicks(int i) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public boolean teleport(Location lctn) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public boolean teleport(Entity entity) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public Entity getPassenger() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public boolean setPassenger(Entity entity) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public boolean isEmpty() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public boolean eject() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void saveData() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void loadData() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public boolean isSleeping() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public int getSleepTicks() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public List getNearbyEntities(double d, double d1, double d2) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public boolean isDead() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public float getFallDistance() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void setFallDistance(float f) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void setSleepingIgnored(boolean bln) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public boolean isSleepingIgnored() { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void awardAchievement(Achievement a) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void incrementStatistic(Statistic ststc) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void incrementStatistic(Statistic ststc, int i) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void incrementStatistic(Statistic ststc, Material mtrl) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void incrementStatistic(Statistic ststc, Material mtrl, int i) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void playNote(Location lctn, byte b, byte b1) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void sendBlockChange(Location lctn, Material mtrl, byte b) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } public void sendBlockChange(Location lctn, int i, byte b) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException(Util.i18n("notSupportedYet")); } } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 112561a05..9682d5127 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -229,7 +229,7 @@ public class Settings implements IConf is = ItemDb.get(itemName); epAlertPlace.add(is.getTypeId()); } catch (Exception ex) { - logger.log(Level.SEVERE, "Unknown item " + itemName + " in alert on placement list."); + logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "alert.on-placement")); } } return epAlertPlace; @@ -248,7 +248,7 @@ public class Settings implements IConf is = ItemDb.get(itemName); epAlertUse.add(is.getTypeId()); } catch (Exception ex) { - logger.log(Level.SEVERE, "Unknown item " + itemName + " in alert on use list."); + logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "alert.on-use")); } } return epAlertUse; @@ -267,7 +267,7 @@ public class Settings implements IConf is = ItemDb.get(itemName); epAlertPlace.add(is.getTypeId()); } catch (Exception ex) { - logger.log(Level.SEVERE, "Unknown item " + itemName + " in alert on break list."); + logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "alert.on-break")); } } return epAlertPlace; @@ -286,7 +286,7 @@ public class Settings implements IConf is = ItemDb.get(itemName); epBlacklistPlacement.add(is.getTypeId()); } catch (Exception ex) { - logger.log(Level.SEVERE, "Unknown item " + itemName + " in placement blacklist."); + logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "blacklist.placement")); } } return epBlacklistPlacement; @@ -305,7 +305,7 @@ public class Settings implements IConf is = ItemDb.get(itemName); epBlackListUsage.add(is.getTypeId()); } catch (Exception ex) { - logger.log(Level.SEVERE, "Unknown item " + itemName + " in usage blacklist."); + logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "blacklist.usage")); } } return epBlackListUsage; @@ -431,7 +431,7 @@ public class Settings implements IConf is = ItemDb.get(itemName); epItemSpwn.add(is.getTypeId()); } catch (Exception ex) { - logger.log(Level.SEVERE, "Unknown item " + itemName + " in item spawn blacklist."); + logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "item-spawn-blacklist")); } } return epItemSpwn; @@ -450,7 +450,7 @@ public class Settings implements IConf is = ItemDb.get(itemName); epBreakList.add(is.getTypeId()); } catch (Exception ex) { - logger.log(Level.SEVERE, "Unknown item " + itemName + " in block breaking blacklist."); + logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "blacklist.break")); } } return epBreakList; diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index 37efb9aea..97b0ac30d 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -84,7 +84,7 @@ public class Teleport implements Runnable try { cooldown(false); - user.sendMessage("§7Teleportation commencing..."); + user.sendMessage(Util.i18n("teleportationCommencing")); try { @@ -96,13 +96,13 @@ public class Teleport implements Runnable } catch (Throwable ex) { - user.sendMessage("§cError: " + ex.getMessage()); + user.sendMessage(Util.format("errorWithMessage", ex.getMessage())); } return; } catch (Exception ex) { - user.sendMessage("§cCooldown: " + ex.getMessage()); + user.sendMessage(Util.format("cooldownWithMessage", ex.getMessage())); } } } @@ -122,7 +122,7 @@ public class Teleport implements Runnable { Location loc = Essentials.getWarps().getWarp(warp); teleport(new Target(loc), chargeFor); - user.sendMessage("§7Warping to " + warp + "."); + user.sendMessage(Util.format("warpingTo", warp)); } public void cooldown(boolean check) throws Exception @@ -137,7 +137,7 @@ public class Teleport implements Runnable cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0)); if (cooldownTime.after(now) && !user.isAuthorized("essentials.teleport.cooldown.bypass")) { - throw new Exception("Time before next teleport: " + Util.formatDateDiff(cooldownTime.getTimeInMillis())); + throw new Exception(Util.format("timeBeforeTeleport", Util.formatDateDiff(cooldownTime.getTimeInMillis()))); } } // if justCheck is set, don't update lastTeleport; we're just checking @@ -158,7 +158,7 @@ public class Teleport implements Runnable user.getServer().getScheduler().cancelTask(teleTimer); if (notifyUser) { - user.sendMessage("§cPending teleportation request cancelled."); + user.sendMessage(Util.i18n("pendingTeleportCancelled")); } } finally @@ -201,7 +201,7 @@ public class Teleport implements Runnable Calendar c = new GregorianCalendar(); c.add(Calendar.SECOND, (int)delay); c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0)); - user.sendMessage("§7Teleportation will commence in " + Util.formatDateDiff(c.getTimeInMillis()) + ". Don't move."); + user.sendMessage(Util.format("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis()))); initTimer((long)(delay * 1000.0), target, chargeFor); teleTimer = user.getServer().getScheduler().scheduleSyncRepeatingTask(Essentials.getStatic(), this, 10, 10); @@ -250,7 +250,7 @@ public class Teleport implements Runnable } else { - throw new Exception(user == this.user ? "You have not set a home." : "Player has not set a home."); + throw new Exception(user == this.user ? Util.i18n("noHomeSet") : Util.i18n("noHomeSetPlayer")); } } teleport(new Target(loc), chargeFor); diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index a6e0e54b6..a6651770d 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -71,7 +71,7 @@ public class User extends UserData implements Comparable, IReplyTo cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0)); if (cooldownTime.after(now) && !isAuthorized("essentials.heal.cooldown.bypass")) { - throw new Exception("Time before next heal: " + Util.formatDateDiff(cooldownTime.getTimeInMillis())); + throw new Exception(Util.format("timeBeforeHeal", Util.formatDateDiff(cooldownTime.getTimeInMillis()))); } } setLastHealTimestamp(now.getTimeInMillis()); @@ -84,7 +84,7 @@ public class User extends UserData implements Comparable, IReplyTo return; } setMoney(getMoney() + value); - sendMessage("§a" + Util.formatCurrency(value) + " has been added to your account."); + sendMessage(Util.format("addedToAccount", Util.formatCurrency(value))); } public void payUser(User reciever, double value) throws Exception @@ -95,14 +95,14 @@ public class User extends UserData implements Comparable, IReplyTo } if (!canAfford(value)) { - throw new Exception("You do not have sufficient funds."); + throw new Exception(Util.i18n("notEnoughMoney")); } else { setMoney(getMoney() - value); reciever.setMoney(reciever.getMoney() + value); - sendMessage("§a" + Util.formatCurrency(value) + " has been sent to " + reciever.getDisplayName()); - reciever.sendMessage("§a" + Util.formatCurrency(value) + " has been recieved from " + getDisplayName()); + sendMessage(Util.format("moneySentTo", Util.formatCurrency(value), reciever.getDisplayName())); + reciever.sendMessage(Util.format("moneyRecievedFrom", Util.formatCurrency(value), getDisplayName())); } } @@ -113,7 +113,7 @@ public class User extends UserData implements Comparable, IReplyTo return; } setMoney(getMoney() - value); - sendMessage("§c" + Util.formatCurrency(value) + " has been taken from your account."); + sendMessage(Util.format("takenFromAccount", Util.formatCurrency(value))); } public void charge(String cmd) throws Exception @@ -127,7 +127,7 @@ public class User extends UserData implements Comparable, IReplyTo double cost = ess.getSettings().getCommandCost(cmd.startsWith("/") ? cmd.substring(1) : cmd); if (mon < cost && !isAuthorized("essentials.eco.loan")) { - throw new Exception("You do not have sufficient funds."); + throw new Exception(Util.i18n("notEnoughMoney")); } takeMoney(cost); } @@ -138,7 +138,7 @@ public class User extends UserData implements Comparable, IReplyTo double cost = ess.getSettings().getCommandCost(cmd.startsWith("/") ? cmd.substring(1) : cmd); if (mon < cost && !isAuthorized("essentials.eco.loan")) { - throw new Exception("You do not have sufficient funds."); + throw new Exception(Util.i18n("notEnoughMoney")); } } diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index 0d9877451..f368368b8 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -124,7 +124,7 @@ public abstract class UserData extends PlayerExtension implements IConf String worldName = loc.getWorld().getName().toLowerCase(); if (worldName == null || worldName.isEmpty()) { - logger.log(Level.WARNING, "Set Home: World name is null or empty."); + logger.log(Level.WARNING, Util.i18n("emptyWorldName")); return; } if (b || !config.hasProperty("home.default")) diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java index 0044dd61b..416be79ae 100644 --- a/Essentials/src/com/earth2me/essentials/Util.java +++ b/Essentials/src/com/earth2me/essentials/Util.java @@ -42,7 +42,7 @@ public class Util boolean future = false; if (toDate.equals(fromDate)) { - return "now"; + return Util.i18n("now"); } if (toDate.after(fromDate)) { @@ -61,23 +61,25 @@ public class Util }; String[] names = new String[] { - "year", - "month", - "day", - "hour", - "minute", - "second" + Util.i18n("year"), + Util.i18n("years"), + Util.i18n("month"), + Util.i18n("months"), + Util.i18n("day"), + Util.i18n("days"), + Util.i18n("hour"), + Util.i18n("hours"), + Util.i18n("minute"), + Util.i18n("minutes"), + Util.i18n("second"), + Util.i18n("seconds") }; for (int i = 0; i < types.length; i++) { int diff = dateDiff(types[i], fromDate, toDate, future); if (diff > 0) { - sb.append(" ").append(diff).append(" ").append(names[i]); - if (diff > 1) - { - sb.append("s"); - } + sb.append(" ").append(diff).append(" ").append(names[i * 2 + (diff > 1 ? 1 : 0)]); } } if (sb.length() == 0) @@ -206,7 +208,7 @@ public class Util { if (loc == null) { - throw new Exception("Destination not set"); + throw new Exception(Util.i18n("destinationNotSet")); } World world = loc.getWorld(); double x = Math.floor(loc.getX()) + 0.5; @@ -218,7 +220,7 @@ public class Util y -= 1.0D; if (y < 0.0D) { - throw new Exception("Hole in floor"); + throw new Exception(Util.i18n("holeInFloor")); } } @@ -268,11 +270,11 @@ public class Util } return isBlockAboveAir(world, x, y, z); } - private static DecimalFormat df = new DecimalFormat("#.00"); + //private static DecimalFormat df = new DecimalFormat("#.00"); public static String formatCurrency(double value) { - return "$" + df.format(value); + return Util.format("currency", value); } public static double roundDouble(double d) diff --git a/Essentials/src/com/earth2me/essentials/Warps.java b/Essentials/src/com/earth2me/essentials/Warps.java index 39bb5ee64..a78393598 100644 --- a/Essentials/src/com/earth2me/essentials/Warps.java +++ b/Essentials/src/com/earth2me/essentials/Warps.java @@ -50,7 +50,7 @@ public class Warps implements IConf EssentialsConf conf = warpPoints.get(new StringIgnoreCase(warp)); if (conf == null) { - throw new Exception("That warp does not exist."); + throw new Exception(Util.i18n("warpNotExist")); } return conf.getLocation(null, server); } @@ -64,7 +64,7 @@ public class Warps implements IConf File confFile = new File(warpsFolder, filename + ".yml"); if (confFile.exists()) { - throw new Exception("A warp with a similar name already exists."); + throw new Exception(Util.i18n("similarWarpExist")); } conf = new EssentialsConf(confFile); warpPoints.put(new StringIgnoreCase(name), conf); @@ -79,11 +79,11 @@ public class Warps implements IConf EssentialsConf conf = warpPoints.get(new StringIgnoreCase(name)); if (conf == null) { - throw new Exception("Warp does not exist."); + throw new Exception(Util.i18n("warpNotExist")); } if (!conf.getFile().delete()) { - throw new Exception("Problem deleting the warp file."); + throw new Exception(Util.i18n("warpDeleteError")); } warpPoints.remove(new StringIgnoreCase(name)); } diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index b5e8bbf63..6602f534c 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -74,3 +74,53 @@ depthAboveSea = \u00a77You are {0} block(s) above sea level. depthBelowSea = \u00a77You are {0} block(s) below sea level. extinguish = \u00a77You extinguished yourself. extinguishOthers = \u00a77 You extinguished {0}. +canTalkAgain = \u00a77You can talk again +haveBeenReleased = \u00a77You have been released +upgradingFilesError = Error while upgrading the files +configFileMoveError = Failed to move config.yml to backup location. +configFileRenameError = Failed to rename temp file to config.yml +fileRenameError = Renaming file {0} failed +userdataMoveError = Failed to move userdata/{0} to userdata/{1}.tmp +duplicatedUserdata = Duplicated userdata: {0} and {1} +userdataMoveBackError = Failed to move userdata/{0}.tmp to userdata/{1} +parseError = Error parsing {0} on line {1} +unknownItemName = Unknown item name: {0} +unknownItemId = Unknown item id: {0} +jailNotExist = That jail does not exist. +unableToSpawnMob = Unable to spawn mob. +creatingPortal = Creating portal at {0},{1},{2}. +notSupportedYet = Not supported yet. +unknownItemInList = Unknown item {0} in {1} list. +teleportationCommencing = \u00a77Teleportation commencing... +cooldownWithMessage = \u00a7cCooldown: {0} +warpingTo = \u00a77Warping to {0}. +timeBeforeTeleport = Time before next teleport: {0} +pendingTeleportCancelled = \u00a7cPending teleportation request cancelled. +dontMoveMessage = \u00a77Teleportation will commence in {0}. Don't move. +noHomeSet = You have not set a home. +noHomeSetPlayer = Player has not set a home. +timeBeforeHeal = Time before next heal: {0} +addedToAccount = \u00a7a{0} has been added to your account. +moneySentTo = \u00a7a{0} has been sent to {1} +moneyRecievedFrom = \u00a7a{0} has been recieved from {1} +takenFromAccount = \u00a7c{0} has been taken from your account. +emptyWorldName = Set Home: World name is null or empty. +now = now +year = year +years = years +month = month +months = months +day = day +days = days +hour = hour +hours = hours +minute = minute +minutes = minutes +second = second +seconds = seconds +destinationNotSet = Destination not set +holeInFloor = Hole in floor +currency = {0,currency} +warpNotExist = That warp does not exist. +similarWarpExist = A warp with a similar name already exists. +warpDeleteError = Problem deleting the warp file. \ No newline at end of file -- cgit v1.2.3