summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-23 09:55:23 +0000
committersnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-23 09:55:23 +0000
commita7217b5f034ff7ce49ad5bd217a142c2b96c05c0 (patch)
treeea5b131956776fcebf1ec832c6241739ae60c2da
parent6b65c5cc830826463b3d743f5fae55905d8aaa08 (diff)
downloadEssentials-a7217b5f034ff7ce49ad5bd217a142c2b96c05c0.tar
Essentials-a7217b5f034ff7ce49ad5bd217a142c2b96c05c0.tar.gz
Essentials-a7217b5f034ff7ce49ad5bd217a142c2b96c05c0.tar.lz
Essentials-a7217b5f034ff7ce49ad5bd217a142c2b96c05c0.tar.xz
Essentials-a7217b5f034ff7ce49ad5bd217a142c2b96c05c0.zip
Removed duplicated message.
Command costs are double values now git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1532 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r--Essentials/src/com/earth2me/essentials/Charge.java15
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java10
2 files changed, 10 insertions, 15 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Charge.java b/Essentials/src/com/earth2me/essentials/Charge.java
index 6f3379eb1..0a4df82bd 100644
--- a/Essentials/src/com/earth2me/essentials/Charge.java
+++ b/Essentials/src/com/earth2me/essentials/Charge.java
@@ -66,14 +66,13 @@ public class Charge
public void charge(User user) throws Exception
{
double mon = user.getMoney();
- if (costs != null && costs != 0.0)
+ if (costs != null)
{
if (mon < costs && !user.isAuthorized("essentials.eco.loan"))
{
throw new Exception(Util.i18n("notEnoughMoney"));
}
user.takeMoney(costs);
- user.sendMessage(Util.format("moneyTaken", Util.formatCurrency(costs)));
}
if (items != null)
{
@@ -92,16 +91,12 @@ public class Charge
return;
}
- int cost = ess.getSettings().getCommandCost(command.startsWith("/") ? command.substring(1) : command);
- if (cost != 0)
+ double cost = ess.getSettings().getCommandCost(command.startsWith("/") ? command.substring(1) : command);
+ if (mon < cost && !user.isAuthorized("essentials.eco.loan"))
{
- if (mon < cost && !user.isAuthorized("essentials.eco.loan"))
- {
- throw new Exception(Util.i18n("notEnoughMoney"));
- }
- user.takeMoney(cost);
- user.sendMessage(Util.format("moneyTaken", Util.formatCurrency(cost)));
+ throw new Exception(Util.i18n("notEnoughMoney"));
}
+ user.takeMoney(cost);
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index 862c559e1..23ca6f3ba 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -101,16 +101,16 @@ public class Settings implements IConf
return config.getBoolean("override-" + name.toLowerCase(), false);
}
- public int getCommandCost(IEssentialsCommand cmd)
+ public double getCommandCost(IEssentialsCommand cmd)
{
return getCommandCost(cmd.getName());
}
- public int getCommandCost(String label)
+ public double getCommandCost(String label)
{
- int cost = config.getInt("command-costs." + label, 0);
- if (cost == 0)
- cost = config.getInt("cost-" + label, 0);
+ double cost = config.getDouble("command-costs." + label, 0.0);
+ if (cost == 0.0)
+ cost = config.getDouble("cost-" + label, 0.0);
return cost;
}