summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-10-10 00:27:55 +0200
committersnowleo <schneeleo@gmail.com>2011-10-10 00:27:55 +0200
commita34c92d55a66339dd71275bb0e0da4bf69b6c4ed (patch)
tree8430e4d4e271d88b1e19387abb8ee54c5988eac5
parent6012086fa5a2593096bd2d39c2435f9ab169c901 (diff)
downloadEssentials-a34c92d55a66339dd71275bb0e0da4bf69b6c4ed.tar
Essentials-a34c92d55a66339dd71275bb0e0da4bf69b6c4ed.tar.gz
Essentials-a34c92d55a66339dd71275bb0e0da4bf69b6c4ed.tar.lz
Essentials-a34c92d55a66339dd71275bb0e0da4bf69b6c4ed.tar.xz
Essentials-a34c92d55a66339dd71275bb0e0da4bf69b6c4ed.zip
Fix of the recharge code, also the maximum line length on signs is 15 not 16!
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignTrade.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
index 9ed5bb058..6c956165a 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
@@ -33,18 +33,22 @@ public class SignTrade extends EssentialsSign
{
if (sign.getLine(3).substring(2).equalsIgnoreCase(username))
{
+ final Trade store = rechargeSign(sign, ess, player);
+ Trade stored = null;
try
{
- final Trade store = rechargeSign(sign, ess, player);
- final Trade stored = getTrade(sign, 1, true, true, ess);
+ stored = getTrade(sign, 1, true, true, ess);
substractAmount(sign, 1, stored, ess);
stored.pay(player);
- Trade.log("Sign", "Trade", "OwnerInteract", username, store, username, stored, sign.getBlock().getLocation(), ess);
}
catch (SignException e)
{
- throw new SignException(Util.i18n("tradeSignEmptyOwner"), e);
+ if (store == null)
+ {
+ throw new SignException(Util.i18n("tradeSignEmptyOwner"), e);
+ }
}
+ Trade.log("Sign", "Trade", "OwnerInteract", username, store, username, stored, sign.getBlock().getLocation(), ess);
}
else
{
@@ -162,7 +166,7 @@ public class SignTrade extends EssentialsSign
throw new SignException(Util.i18n("moreThanZero"));
}
String newline = amount + " " + split[1] + ":0";
- if ((newline + amount).length() > 16)
+ if ((newline + amount).length() > 15)
{
throw new SignException("Line can be too long!");
}
@@ -272,7 +276,7 @@ public class SignTrade extends EssentialsSign
if (money != null && amount != null)
{
final String newline = Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount + value, ess).substring(1);
- if (newline.length() > 16)
+ if (newline.length() > 15)
{
throw new SignException("Line too long!");
}
@@ -287,7 +291,7 @@ public class SignTrade extends EssentialsSign
final ItemStack item = getItemStack(split[1], stackamount, ess);
final int amount = getInteger(split[2]);
final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value));
- if (newline.length() > 16)
+ if (newline.length() > 15)
{
throw new SignException("Line too long!");
}