mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-07-02 18:53:43 +00:00
[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
This commit is contained in:
parent
9a85c73c9f
commit
c1ac5b345f
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue