mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-07-18 02:06:08 +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()
|
public long getTeleportCooldown()
|
||||||
{
|
{
|
||||||
return (long)config.getInt("teleport-cooldown", 60) * 1000L;
|
return ((Number)config.getInt("teleport-cooldown", 60)).longValue() * 1000L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getHealCooldown()
|
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)
|
public Object getKit(String name)
|
||||||
|
|
|
@ -262,9 +262,10 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
|
||||||
load();
|
load();
|
||||||
if (data.containsKey("money"))
|
if (data.containsKey("money"))
|
||||||
{
|
{
|
||||||
if (data.get("money") instanceof Integer)
|
if (data.get("money") instanceof Number) {
|
||||||
return (double)((Integer)data.get("money"));
|
return ((Number)data.get("money")).doubleValue();
|
||||||
return (Double)data.get("money");
|
}
|
||||||
|
logger.log(Level.SEVERE, "Can't convert money value to double:"+ data.get("money"));
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -276,7 +277,7 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Map<String, Object> idata = Essentials.getData(this);
|
Map<String, Object> idata = Essentials.getData(this);
|
||||||
return (Integer)idata.get("money");
|
return ((Number)idata.get("money")).doubleValue();
|
||||||
}
|
}
|
||||||
catch (Throwable ex2)
|
catch (Throwable ex2)
|
||||||
{
|
{
|
||||||
|
@ -496,11 +497,11 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
|
||||||
}
|
}
|
||||||
return new Location(
|
return new Location(
|
||||||
world,
|
world,
|
||||||
(Double)vals.get(0),
|
((Number)vals.get(0)).doubleValue(),
|
||||||
(Double)vals.get(1),
|
((Number)vals.get(1)).doubleValue(),
|
||||||
(Double)vals.get(2),
|
((Number)vals.get(2)).doubleValue(),
|
||||||
((Double)vals.get(3)).floatValue(),
|
((Number)vals.get(3)).floatValue(),
|
||||||
((Double)vals.get(4)).floatValue());
|
((Number)vals.get(4)).floatValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -512,11 +513,11 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
|
||||||
world = getServer().getWorld((String)vals.get(5));
|
world = getServer().getWorld((String)vals.get(5));
|
||||||
}
|
}
|
||||||
return new Location(world,
|
return new Location(world,
|
||||||
(Double)vals.get(0),
|
((Number)vals.get(0)).doubleValue(),
|
||||||
(Double)vals.get(1),
|
((Number)vals.get(1)).doubleValue(),
|
||||||
(Double)vals.get(2),
|
((Number)vals.get(2)).doubleValue(),
|
||||||
((Double)vals.get(3)).floatValue(),
|
((Number)vals.get(3)).floatValue(),
|
||||||
((Double)vals.get(4)).floatValue());
|
((Number)vals.get(4)).floatValue());
|
||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class Commandkit extends EssentialsCommand
|
||||||
//System.out.println("Kit is timed");
|
//System.out.println("Kit is timed");
|
||||||
Map<String, Object> els = (Map<String, Object>)kit;
|
Map<String, Object> els = (Map<String, Object>)kit;
|
||||||
items = (List<String>)els.get("items");
|
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();
|
long time = Calendar.getInstance().getTimeInMillis();
|
||||||
|
|
||||||
Map<String, Long> kitTimes;
|
Map<String, Long> kitTimes;
|
||||||
|
|
Loading…
Reference in a new issue