summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
diff options
context:
space:
mode:
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/signs/SignTrade.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignTrade.java26
1 files changed, 12 insertions, 14 deletions
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
index 6c956165a..c2f3eb8e4 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
@@ -1,10 +1,7 @@
package com.earth2me.essentials.signs;
-import com.earth2me.essentials.ChargeException;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.Trade;
-import com.earth2me.essentials.User;
-import com.earth2me.essentials.Util;
+import static com.earth2me.essentials.I18n._;
+import com.earth2me.essentials.*;
import org.bukkit.inventory.ItemStack;
@@ -45,7 +42,7 @@ public class SignTrade extends EssentialsSign
{
if (store == null)
{
- throw new SignException(Util.i18n("tradeSignEmptyOwner"), e);
+ throw new SignException(_("tradeSignEmptyOwner"), e);
}
}
Trade.log("Sign", "Trade", "OwnerInteract", username, store, username, stored, sign.getBlock().getLocation(), ess);
@@ -150,7 +147,7 @@ public class SignTrade extends EssentialsSign
amount -= amount % money;
if (amount < 0.01 || money < 0.01)
{
- throw new SignException(Util.i18n("moreThanZero"));
+ throw new SignException(_("moreThanZero"));
}
sign.setLine(index, Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount, ess).substring(1));
return;
@@ -163,7 +160,7 @@ public class SignTrade extends EssentialsSign
final ItemStack item = getItemStack(split[1], amount, ess);
if (amount < 1 || item.getTypeId() == 0)
{
- throw new SignException(Util.i18n("moreThanZero"));
+ throw new SignException(_("moreThanZero"));
}
String newline = amount + " " + split[1] + ":0";
if ((newline + amount).length() > 15)
@@ -182,12 +179,12 @@ public class SignTrade extends EssentialsSign
amount -= amount % stackamount;
if (amount < 1 || stackamount < 1 || item.getTypeId() == 0)
{
- throw new SignException(Util.i18n("moreThanZero"));
+ throw new SignException(_("moreThanZero"));
}
sign.setLine(index, stackamount + " " + split[1] + ":" + amount);
return;
}
- throw new SignException(Util.format("invalidSignLine", index + 1));
+ throw new SignException(_("invalidSignLine", index + 1));
}
protected final Trade getTrade(final ISign sign, final int index, final boolean fullAmount, final boolean notEmpty, final IEssentials ess) throws SignException
@@ -212,7 +209,7 @@ public class SignTrade extends EssentialsSign
}
catch (SignException e)
{
- throw new SignException(Util.i18n("tradeSignEmpty"));
+ throw new SignException(_("tradeSignEmpty"));
}
}
@@ -224,12 +221,12 @@ public class SignTrade extends EssentialsSign
amount -= amount % stackamount;
if (notEmpty && (amount < 1 || stackamount < 1 || item.getTypeId() == 0))
{
- throw new SignException(Util.i18n("tradeSignEmpty"));
+ throw new SignException(_("tradeSignEmpty"));
}
item.setAmount(fullAmount ? amount : stackamount);
return new Trade(item, ess);
}
- throw new SignException(Util.format("invalidSignLine", index + 1));
+ throw new SignException(_("invalidSignLine", index + 1));
}
protected final void substractAmount(final ISign sign, final int index, final Trade trade, final IEssentials ess) throws SignException
@@ -288,6 +285,7 @@ public class SignTrade extends EssentialsSign
if (split.length == 3)
{
final int stackamount = getIntegerPositive(split[0]);
+ //TODO: Unused local variable
final ItemStack item = getItemStack(split[1], stackamount, ess);
final int amount = getInteger(split[2]);
final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value));
@@ -298,6 +296,6 @@ public class SignTrade extends EssentialsSign
sign.setLine(index, newline);
return;
}
- throw new SignException(Util.format("invalidSignLine", index + 1));
+ throw new SignException(_("invalidSignLine", index + 1));
}
}