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
This commit is contained in:
snowleo 2011-05-10 19:02:59 +00:00
parent 4176d3f0da
commit 8e1f018104
14 changed files with 167 additions and 116 deletions

View file

@ -48,13 +48,13 @@ public class EssentialsTimer implements Runnable, IConf
} }
if (user.getMuteTimeout() > 0 && user.getMuteTimeout() < currentTime && user.isMuted()) { if (user.getMuteTimeout() > 0 && user.getMuteTimeout() < currentTime && user.isMuted()) {
user.setMuteTimeout(0); user.setMuteTimeout(0);
user.sendMessage("§7You can talk again"); user.sendMessage(Util.i18n("canTalkAgain"));
user.setMuted(false); user.setMuted(false);
} }
if (user.getJailTimeout() > 0 && user.getJailTimeout() < currentTime && user.isJailed()) { if (user.getJailTimeout() > 0 && user.getJailTimeout() < currentTime && user.isJailed()) {
user.setJailTimeout(0); user.setJailTimeout(0);
user.setJailed(false); user.setJailed(false);
user.sendMessage("§7You have been released"); user.sendMessage(Util.i18n("haveBeenReleased"));
user.setJail(null); user.setJail(null);
try try
{ {

View file

@ -64,7 +64,7 @@ public class EssentialsUpgrade
} }
catch (Throwable e) 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")))) 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)) if (!tempFile.renameTo(file))
{ {
throw new Exception("Failed to rename temp file to config.yml"); throw new Exception(Util.i18n("configFileRenameError"));
} }
} else { } else {
tempFile.delete(); tempFile.delete();
@ -273,7 +273,7 @@ public class EssentialsUpgrade
Essentials.getWarps().setWarp(filename.substring(0, filename.length() - 4), loc); Essentials.getWarps().setWarp(filename.substring(0, filename.length() - 4), loc);
if (!listOfFiles[i].renameTo(new File(warpsFolder, filename + ".old"))) 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) catch (Exception ex)
@ -319,7 +319,7 @@ public class EssentialsUpgrade
Essentials.getWarps().setWarp(name, loc); Essentials.getWarps().setWarp(name, loc);
if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old"))) 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 tmpFile = new File(listOfFiles[i].getParentFile(), sanitizedFilename + ".tmp");
File newFile = new File(listOfFiles[i].getParentFile(), sanitizedFilename); File newFile = new File(listOfFiles[i].getParentFile(), sanitizedFilename);
if (!listOfFiles[i].renameTo(tmpFile)) { 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; continue;
} }
if (newFile.exists()) if (newFile.exists())
{ {
logger.log(Level.WARNING, "Duplicated userdata: "+filename+" and "+sanitizedFilename); logger.log(Level.WARNING, Util.format("duplicatedUserdata", filename, sanitizedFilename));
continue; continue;
} }
if (!tmpFile.renameTo(newFile)) { 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));
} }
} }
} }

View file

@ -18,7 +18,6 @@ public class ItemDb
private static Map<String, Integer> items = new HashMap<String, Integer>(); private static Map<String, Integer> items = new HashMap<String, Integer>();
private static Map<String, Short> durabilities = new HashMap<String, Short>(); private static Map<String, Short> durabilities = new HashMap<String, Short>();
@SuppressWarnings("LoggerStringConcat")
public static void load(File folder, String fname) throws IOException public static void load(File folder, String fname) throws IOException
{ {
folder.mkdirs(); folder.mkdirs();
@ -78,7 +77,7 @@ public class ItemDb
} }
catch (Exception ex) 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 else
{ {
throw new Exception("Unknown item name: " + id); throw new Exception(Util.format("unknownItemName", id));
} }
} }
Material mat = Material.getMaterial(itemid); Material mat = Material.getMaterial(itemid);
if (mat == null) if (mat == null)
{ {
throw new Exception("Unknown item id: " + itemid); throw new Exception(Util.format("unknownItemId", itemid));
} }
ItemStack retval = new ItemStack(mat); ItemStack retval = new ItemStack(mat);
retval.setAmount(Essentials.getStatic().getSettings().getDefaultStackSize()); retval.setAmount(Essentials.getStatic().getSettings().getDefaultStackSize());

View file

@ -33,7 +33,7 @@ public class Jail extends BlockListener implements IConf
{ {
if (config.getProperty(jailName.toLowerCase()) == null) 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()); Location loc = config.getLocation(jailName.toLowerCase(), Essentials.getStatic().getServer());

View file

@ -93,7 +93,7 @@ public enum Mob
} }
catch (Exception ex) catch (Exception ex)
{ {
logger.warning("Unable to spawn mob."); logger.warning(Util.i18n("unableToSpawnMob"));
ex.printStackTrace(); ex.printStackTrace();
throw new MobException(); throw new MobException();
} }

View file

@ -120,7 +120,7 @@ public class NetherPortal
// For now, don't worry about direction // For now, don't worry about direction
int x = dest.getX(), y = dest.getY(), z = dest.getZ(); 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 // Clear area around portal
ArrayList<Block> columns = new ArrayList<Block>(); ArrayList<Block> columns = new ArrayList<Block>();

View file

@ -160,22 +160,22 @@ public class OfflinePlayer implements Player
public int getRemainingAir() public int getRemainingAir()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void setRemainingAir(int i) public void setRemainingAir(int i)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public int getMaximumAir() public int getMaximumAir()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void setMaximumAir(int i) public void setMaximumAir(int i)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public boolean isSneaking() public boolean isSneaking()
@ -185,62 +185,62 @@ public class OfflinePlayer implements Player
public void setSneaking(boolean bln) public void setSneaking(boolean bln)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void updateInventory() public void updateInventory()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void chat(String string) public void chat(String string)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public double getEyeHeight() public double getEyeHeight()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public double getEyeHeight(boolean bln) public double getEyeHeight(boolean bln)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public List<Block> getLineOfSight(HashSet<Byte> hs, int i) public List<Block> getLineOfSight(HashSet<Byte> hs, int i)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public Block getTargetBlock(HashSet<Byte> hs, int i) public Block getTargetBlock(HashSet<Byte> hs, int i)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> hs, int i) public List<Block> getLastTwoTargetBlocks(HashSet<Byte> hs, int i)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public int getFireTicks() public int getFireTicks()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public int getMaxFireTicks() public int getMaxFireTicks()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void setFireTicks(int i) public void setFireTicks(int i)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void remove() public void remove()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public Server getServer() public Server getServer()
@ -250,195 +250,195 @@ public class OfflinePlayer implements Player
public Vector getMomentum() public Vector getMomentum()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void setMomentum(Vector vector) public void setMomentum(Vector vector)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void setVelocity(Vector vector) public void setVelocity(Vector vector)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public Vector getVelocity() public Vector getVelocity()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void damage(int i) public void damage(int i)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void damage(int i, Entity entity) public void damage(int i, Entity entity)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public Location getEyeLocation() public Location getEyeLocation()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void sendRawMessage(String string) { public void sendRawMessage(String string) {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public Location getCompassTarget() public Location getCompassTarget()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public int getMaximumNoDamageTicks() public int getMaximumNoDamageTicks()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void setMaximumNoDamageTicks(int i) public void setMaximumNoDamageTicks(int i)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public int getLastDamage() public int getLastDamage()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void setLastDamage(int i) public void setLastDamage(int i)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public int getNoDamageTicks() public int getNoDamageTicks()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void setNoDamageTicks(int i) public void setNoDamageTicks(int i)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public boolean teleport(Location lctn) public boolean teleport(Location lctn)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public boolean teleport(Entity entity) public boolean teleport(Entity entity)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public Entity getPassenger() public Entity getPassenger()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public boolean setPassenger(Entity entity) public boolean setPassenger(Entity entity)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public boolean isEmpty() public boolean isEmpty()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public boolean eject() public boolean eject()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void saveData() public void saveData()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void loadData() public void loadData()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public boolean isSleeping() public boolean isSleeping()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public int getSleepTicks() public int getSleepTicks()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public List<Entity> getNearbyEntities(double d, double d1, double d2) public List<Entity> getNearbyEntities(double d, double d1, double d2)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public boolean isDead() public boolean isDead()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public float getFallDistance() public float getFallDistance()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void setFallDistance(float f) public void setFallDistance(float f)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void setSleepingIgnored(boolean bln) public void setSleepingIgnored(boolean bln)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public boolean isSleepingIgnored() public boolean isSleepingIgnored()
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void awardAchievement(Achievement a) public void awardAchievement(Achievement a)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void incrementStatistic(Statistic ststc) public void incrementStatistic(Statistic ststc)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
public void incrementStatistic(Statistic ststc, int i) 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) 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) 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) 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) 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) public void sendBlockChange(Location lctn, int i, byte b)
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
} }
} }

View file

@ -229,7 +229,7 @@ public class Settings implements IConf
is = ItemDb.get(itemName); is = ItemDb.get(itemName);
epAlertPlace.add(is.getTypeId()); epAlertPlace.add(is.getTypeId());
} catch (Exception ex) { } 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; return epAlertPlace;
@ -248,7 +248,7 @@ public class Settings implements IConf
is = ItemDb.get(itemName); is = ItemDb.get(itemName);
epAlertUse.add(is.getTypeId()); epAlertUse.add(is.getTypeId());
} catch (Exception ex) { } 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; return epAlertUse;
@ -267,7 +267,7 @@ public class Settings implements IConf
is = ItemDb.get(itemName); is = ItemDb.get(itemName);
epAlertPlace.add(is.getTypeId()); epAlertPlace.add(is.getTypeId());
} catch (Exception ex) { } 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; return epAlertPlace;
@ -286,7 +286,7 @@ public class Settings implements IConf
is = ItemDb.get(itemName); is = ItemDb.get(itemName);
epBlacklistPlacement.add(is.getTypeId()); epBlacklistPlacement.add(is.getTypeId());
} catch (Exception ex) { } 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; return epBlacklistPlacement;
@ -305,7 +305,7 @@ public class Settings implements IConf
is = ItemDb.get(itemName); is = ItemDb.get(itemName);
epBlackListUsage.add(is.getTypeId()); epBlackListUsage.add(is.getTypeId());
} catch (Exception ex) { } 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; return epBlackListUsage;
@ -431,7 +431,7 @@ public class Settings implements IConf
is = ItemDb.get(itemName); is = ItemDb.get(itemName);
epItemSpwn.add(is.getTypeId()); epItemSpwn.add(is.getTypeId());
} catch (Exception ex) { } 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; return epItemSpwn;
@ -450,7 +450,7 @@ public class Settings implements IConf
is = ItemDb.get(itemName); is = ItemDb.get(itemName);
epBreakList.add(is.getTypeId()); epBreakList.add(is.getTypeId());
} catch (Exception ex) { } 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; return epBreakList;

View file

@ -84,7 +84,7 @@ public class Teleport implements Runnable
try try
{ {
cooldown(false); cooldown(false);
user.sendMessage("§7Teleportation commencing..."); user.sendMessage(Util.i18n("teleportationCommencing"));
try try
{ {
@ -96,13 +96,13 @@ public class Teleport implements Runnable
} }
catch (Throwable ex) catch (Throwable ex)
{ {
user.sendMessage("§cError: " + ex.getMessage()); user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
} }
return; return;
} }
catch (Exception ex) 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); Location loc = Essentials.getWarps().getWarp(warp);
teleport(new Target(loc), chargeFor); teleport(new Target(loc), chargeFor);
user.sendMessage("§7Warping to " + warp + "."); user.sendMessage(Util.format("warpingTo", warp));
} }
public void cooldown(boolean check) throws Exception 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)); cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
if (cooldownTime.after(now) && !user.isAuthorized("essentials.teleport.cooldown.bypass")) 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 // 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); user.getServer().getScheduler().cancelTask(teleTimer);
if (notifyUser) if (notifyUser)
{ {
user.sendMessage("§cPending teleportation request cancelled."); user.sendMessage(Util.i18n("pendingTeleportCancelled"));
} }
} }
finally finally
@ -201,7 +201,7 @@ public class Teleport implements Runnable
Calendar c = new GregorianCalendar(); Calendar c = new GregorianCalendar();
c.add(Calendar.SECOND, (int)delay); c.add(Calendar.SECOND, (int)delay);
c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0)); 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); initTimer((long)(delay * 1000.0), target, chargeFor);
teleTimer = user.getServer().getScheduler().scheduleSyncRepeatingTask(Essentials.getStatic(), this, 10, 10); teleTimer = user.getServer().getScheduler().scheduleSyncRepeatingTask(Essentials.getStatic(), this, 10, 10);
@ -250,7 +250,7 @@ public class Teleport implements Runnable
} }
else 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); teleport(new Target(loc), chargeFor);

View file

@ -71,7 +71,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo
cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0)); cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
if (cooldownTime.after(now) && !isAuthorized("essentials.heal.cooldown.bypass")) 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()); setLastHealTimestamp(now.getTimeInMillis());
@ -84,7 +84,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo
return; return;
} }
setMoney(getMoney() + value); 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 public void payUser(User reciever, double value) throws Exception
@ -95,14 +95,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo
} }
if (!canAfford(value)) if (!canAfford(value))
{ {
throw new Exception("You do not have sufficient funds."); throw new Exception(Util.i18n("notEnoughMoney"));
} }
else else
{ {
setMoney(getMoney() - value); setMoney(getMoney() - value);
reciever.setMoney(reciever.getMoney() + value); reciever.setMoney(reciever.getMoney() + value);
sendMessage("§a" + Util.formatCurrency(value) + " has been sent to " + reciever.getDisplayName()); sendMessage(Util.format("moneySentTo", Util.formatCurrency(value), reciever.getDisplayName()));
reciever.sendMessage("§a" + Util.formatCurrency(value) + " has been recieved from " + getDisplayName()); reciever.sendMessage(Util.format("moneyRecievedFrom", Util.formatCurrency(value), getDisplayName()));
} }
} }
@ -113,7 +113,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo
return; return;
} }
setMoney(getMoney() - value); 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 public void charge(String cmd) throws Exception
@ -127,7 +127,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo
double cost = ess.getSettings().getCommandCost(cmd.startsWith("/") ? cmd.substring(1) : cmd); double cost = ess.getSettings().getCommandCost(cmd.startsWith("/") ? cmd.substring(1) : cmd);
if (mon < cost && !isAuthorized("essentials.eco.loan")) if (mon < cost && !isAuthorized("essentials.eco.loan"))
{ {
throw new Exception("You do not have sufficient funds."); throw new Exception(Util.i18n("notEnoughMoney"));
} }
takeMoney(cost); takeMoney(cost);
} }
@ -138,7 +138,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo
double cost = ess.getSettings().getCommandCost(cmd.startsWith("/") ? cmd.substring(1) : cmd); double cost = ess.getSettings().getCommandCost(cmd.startsWith("/") ? cmd.substring(1) : cmd);
if (mon < cost && !isAuthorized("essentials.eco.loan")) if (mon < cost && !isAuthorized("essentials.eco.loan"))
{ {
throw new Exception("You do not have sufficient funds."); throw new Exception(Util.i18n("notEnoughMoney"));
} }
} }

View file

@ -124,7 +124,7 @@ public abstract class UserData extends PlayerExtension implements IConf
String worldName = loc.getWorld().getName().toLowerCase(); String worldName = loc.getWorld().getName().toLowerCase();
if (worldName == null || worldName.isEmpty()) 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; return;
} }
if (b || !config.hasProperty("home.default")) if (b || !config.hasProperty("home.default"))

View file

@ -42,7 +42,7 @@ public class Util
boolean future = false; boolean future = false;
if (toDate.equals(fromDate)) if (toDate.equals(fromDate))
{ {
return "now"; return Util.i18n("now");
} }
if (toDate.after(fromDate)) if (toDate.after(fromDate))
{ {
@ -61,23 +61,25 @@ public class Util
}; };
String[] names = new String[] String[] names = new String[]
{ {
"year", Util.i18n("year"),
"month", Util.i18n("years"),
"day", Util.i18n("month"),
"hour", Util.i18n("months"),
"minute", Util.i18n("day"),
"second" 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++) for (int i = 0; i < types.length; i++)
{ {
int diff = dateDiff(types[i], fromDate, toDate, future); int diff = dateDiff(types[i], fromDate, toDate, future);
if (diff > 0) if (diff > 0)
{ {
sb.append(" ").append(diff).append(" ").append(names[i]); sb.append(" ").append(diff).append(" ").append(names[i * 2 + (diff > 1 ? 1 : 0)]);
if (diff > 1)
{
sb.append("s");
}
} }
} }
if (sb.length() == 0) if (sb.length() == 0)
@ -206,7 +208,7 @@ public class Util
{ {
if (loc == null) if (loc == null)
{ {
throw new Exception("Destination not set"); throw new Exception(Util.i18n("destinationNotSet"));
} }
World world = loc.getWorld(); World world = loc.getWorld();
double x = Math.floor(loc.getX()) + 0.5; double x = Math.floor(loc.getX()) + 0.5;
@ -218,7 +220,7 @@ public class Util
y -= 1.0D; y -= 1.0D;
if (y < 0.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); 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) public static String formatCurrency(double value)
{ {
return "$" + df.format(value); return Util.format("currency", value);
} }
public static double roundDouble(double d) public static double roundDouble(double d)

View file

@ -50,7 +50,7 @@ public class Warps implements IConf
EssentialsConf conf = warpPoints.get(new StringIgnoreCase(warp)); EssentialsConf conf = warpPoints.get(new StringIgnoreCase(warp));
if (conf == null) if (conf == null)
{ {
throw new Exception("That warp does not exist."); throw new Exception(Util.i18n("warpNotExist"));
} }
return conf.getLocation(null, server); return conf.getLocation(null, server);
} }
@ -64,7 +64,7 @@ public class Warps implements IConf
File confFile = new File(warpsFolder, filename + ".yml"); File confFile = new File(warpsFolder, filename + ".yml");
if (confFile.exists()) if (confFile.exists())
{ {
throw new Exception("A warp with a similar name already exists."); throw new Exception(Util.i18n("similarWarpExist"));
} }
conf = new EssentialsConf(confFile); conf = new EssentialsConf(confFile);
warpPoints.put(new StringIgnoreCase(name), conf); warpPoints.put(new StringIgnoreCase(name), conf);
@ -79,11 +79,11 @@ public class Warps implements IConf
EssentialsConf conf = warpPoints.get(new StringIgnoreCase(name)); EssentialsConf conf = warpPoints.get(new StringIgnoreCase(name));
if (conf == null) if (conf == null)
{ {
throw new Exception("Warp does not exist."); throw new Exception(Util.i18n("warpNotExist"));
} }
if (!conf.getFile().delete()) if (!conf.getFile().delete())
{ {
throw new Exception("Problem deleting the warp file."); throw new Exception(Util.i18n("warpDeleteError"));
} }
warpPoints.remove(new StringIgnoreCase(name)); warpPoints.remove(new StringIgnoreCase(name));
} }

View file

@ -74,3 +74,53 @@ depthAboveSea = \u00a77You are {0} block(s) above sea level.
depthBelowSea = \u00a77You are {0} block(s) below sea level. depthBelowSea = \u00a77You are {0} block(s) below sea level.
extinguish = \u00a77You extinguished yourself. extinguish = \u00a77You extinguished yourself.
extinguishOthers = \u00a77 You extinguished {0}. 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.