diff options
author | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-06 10:32:59 +0000 |
---|---|---|
committer | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-06 10:32:59 +0000 |
commit | c1ac5b345f1fd0bef48ec15a0c3f46daad26dfcf (patch) | |
tree | 2ae5604cce47df7c7ecd3b653766f9325c95b70d | |
parent | 9a85c73c9f6baaa9552fbe636ac62e765ec9c8c1 (diff) | |
download | Essentials-c1ac5b345f1fd0bef48ec15a0c3f46daad26dfcf.tar Essentials-c1ac5b345f1fd0bef48ec15a0c3f46daad26dfcf.tar.gz Essentials-c1ac5b345f1fd0bef48ec15a0c3f46daad26dfcf.tar.lz Essentials-c1ac5b345f1fd0bef48ec15a0c3f46daad26dfcf.tar.xz Essentials-c1ac5b345f1fd0bef48ec15a0c3f46daad26dfcf.zip |
[trunk] Don't expect the values from yaml to be a specific number format.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1141 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r-- | Essentials/src/com/earth2me/essentials/Settings.java | 4 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/User.java | 29 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandkit.java | 2 |
3 files changed, 18 insertions, 17 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index d75530aae..9525eb378 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -123,12 +123,12 @@ public class Settings implements IConf public long getTeleportCooldown() { - return (long)config.getInt("teleport-cooldown", 60) * 1000L; + return ((Number)config.getInt("teleport-cooldown", 60)).longValue() * 1000L; } public long getHealCooldown() { - return (long)config.getInt("heal-cooldown", 60) * 1000L; + return ((Number)config.getInt("heal-cooldown", 60)).longValue() * 1000L; } public Object getKit(String name) diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 272bc8cc4..1b14c7be5 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -262,9 +262,10 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo load(); if (data.containsKey("money")) { - if (data.get("money") instanceof Integer) - return (double)((Integer)data.get("money")); - return (Double)data.get("money"); + if (data.get("money") instanceof Number) { + return ((Number)data.get("money")).doubleValue(); + } + logger.log(Level.SEVERE, "Can't convert money value to double:"+ data.get("money")); } try @@ -276,7 +277,7 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo try { Map<String, Object> idata = Essentials.getData(this); - return (Integer)idata.get("money"); + return ((Number)idata.get("money")).doubleValue(); } catch (Throwable ex2) { @@ -496,11 +497,11 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo } return new Location( world, - (Double)vals.get(0), - (Double)vals.get(1), - (Double)vals.get(2), - ((Double)vals.get(3)).floatValue(), - ((Double)vals.get(4)).floatValue()); + ((Number)vals.get(0)).doubleValue(), + ((Number)vals.get(1)).doubleValue(), + ((Number)vals.get(2)).doubleValue(), + ((Number)vals.get(3)).floatValue(), + ((Number)vals.get(4)).floatValue()); } try @@ -512,11 +513,11 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo world = getServer().getWorld((String)vals.get(5)); } return new Location(world, - (Double)vals.get(0), - (Double)vals.get(1), - (Double)vals.get(2), - ((Double)vals.get(3)).floatValue(), - ((Double)vals.get(4)).floatValue()); + ((Number)vals.get(0)).doubleValue(), + ((Number)vals.get(1)).doubleValue(), + ((Number)vals.get(2)).doubleValue(), + ((Number)vals.get(3)).floatValue(), + ((Number)vals.get(4)).floatValue()); } catch (Throwable ex) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java index 31c66da22..a3522e679 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java @@ -69,7 +69,7 @@ public class Commandkit extends EssentialsCommand //System.out.println("Kit is timed"); Map<String, Object> els = (Map<String, Object>)kit; items = (List<String>)els.get("items"); - long delay = els.containsKey("delay") ? (Integer)els.get("delay") * 1000L : 0L; + long delay = els.containsKey("delay") ? ((Number)els.get("delay")).longValue() * 1000L : 0L; long time = Calendar.getInstance().getTimeInMillis(); Map<String, Long> kitTimes; |