summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxeology <xeology@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-08 19:09:04 +0000
committerxeology <xeology@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-08 19:09:04 +0000
commit79a09fe046537dab5def10898ebd3b4071e4ef97 (patch)
tree5786ab0405cd706ad29ebbf5179d117ad25b9433
parent840ce9c190c6702803a596ee3b98e97e297b5bc1 (diff)
downloadEssentials-79a09fe046537dab5def10898ebd3b4071e4ef97.tar
Essentials-79a09fe046537dab5def10898ebd3b4071e4ef97.tar.gz
Essentials-79a09fe046537dab5def10898ebd3b4071e4ef97.tar.lz
Essentials-79a09fe046537dab5def10898ebd3b4071e4ef97.tar.xz
Essentials-79a09fe046537dab5def10898ebd3b4071e4ef97.zip
Attempted fix on API overwriting values.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1370 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r--Essentials/src/com/earth2me/essentials/api/Economy.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/api/Economy.java b/Essentials/src/com/earth2me/essentials/api/Economy.java
index 9deb408d1..089f04437 100644
--- a/Essentials/src/com/earth2me/essentials/api/Economy.java
+++ b/Essentials/src/com/earth2me/essentials/api/Economy.java
@@ -156,18 +156,19 @@ public class Economy
//Eco add balance
public static void add(String name, double money)
{
+ double result;
if (!exist(name))
{
if (accountCreated(name))
{
User user = usrConv(name);
- double result = user.getMoney() + money;
+ result = user.getMoney() + money;
user.setMoney(money);
}
return;
}
User user = usrConv(name);
- double result = user.getMoney() + money;
+ result = user.getMoney() + money;
user.setMoney(result);
return;
}
@@ -175,19 +176,20 @@ public class Economy
//Eco divide balance
public static void divide(String name, double money)
{
+ double result;
if (!exist(name))
{
if (accountCreated(name))
{
User user = usrConv(name);
- double result = user.getMoney() / money;
+ result = user.getMoney() / money;
user.setMoney(result);
return;
}
return;
}
User user = usrConv(name);
- double result = user.getMoney() / money;
+ result = user.getMoney() / money;
user.setMoney(result);
return;
}
@@ -195,19 +197,20 @@ public class Economy
//Eco multiply balance
public static void multiply(String name, double money)
{
+ double result;
if (!exist(name))
{
if (accountCreated(name))
{
User user = usrConv(name);
- double result = user.getMoney() * money;
+ result = user.getMoney() * money;
user.setMoney(result);
return;
}
return;
}
User user = usrConv(name);
- double result = user.getMoney() * money;
+ result = user.getMoney() * money;
user.setMoney(result);
return;
}
@@ -215,19 +218,20 @@ public class Economy
//Eco subtract balance
public static void subtract(String name, double money)
{
+ double result;
if (!exist(name))
{
if (accountCreated(name))
{
User user = usrConv(name);
- double result = user.getMoney() - money;
+ result = user.getMoney() - money;
user.setMoney(result);
return;
}
return;
}
User user = usrConv(name);
- double result = user.getMoney() - money;
+ result = user.getMoney() - money;
user.setMoney(result);
return;
}