summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokamosy <okamosy@gmail.com>2011-08-21 02:53:10 +0100
committerokamosy <okamosy@gmail.com>2011-08-21 02:53:10 +0100
commit8d1ad411b7eff4daf7b3f7484b10300d7a6bd0bc (patch)
treeffbbb2fb03c5bf12ec6444af0922069eb91d930e
parent8be8e2350969fc6d86743880f45e1c24ba78f46c (diff)
parentaefc9b99427833cc8e4937d653ebec4f28754eb1 (diff)
downloadEssentials-8d1ad411b7eff4daf7b3f7484b10300d7a6bd0bc.tar
Essentials-8d1ad411b7eff4daf7b3f7484b10300d7a6bd0bc.tar.gz
Essentials-8d1ad411b7eff4daf7b3f7484b10300d7a6bd0bc.tar.lz
Essentials-8d1ad411b7eff4daf7b3f7484b10300d7a6bd0bc.tar.xz
Essentials-8d1ad411b7eff4daf7b3f7484b10300d7a6bd0bc.zip
Merge branch 'master' of github.com:khobbits/Essentials
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignTrade.java39
-rw-r--r--Essentials/src/messages.properties3
-rw-r--r--Essentials/src/messages_da.properties1
-rw-r--r--Essentials/src/messages_de.properties1
-rw-r--r--Essentials/src/messages_en.properties1
-rw-r--r--Essentials/src/messages_fr.properties1
-rw-r--r--Essentials/src/messages_nl.properties1
7 files changed, 34 insertions, 13 deletions
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
index ccbd4fd9d..a1a066088 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
@@ -10,6 +10,7 @@ import org.bukkit.inventory.ItemStack;
public class SignTrade extends EssentialsSign
{
+
public SignTrade()
{
super("Trade");
@@ -33,10 +34,17 @@ public class SignTrade extends EssentialsSign
{
if (sign.getLine(3).substring(2).equalsIgnoreCase(username))
{
- final Trade stored = getTrade(sign, 1, true, true, ess);
- substractAmount(sign, 1, stored, ess);
- stored.pay(player);
- Trade.log("Sign", "Trade", "OwnerInteract", username, null, username, stored, sign.getBlock().getLocation(), ess);
+ try
+ {
+ final Trade stored = getTrade(sign, 1, true, true, ess);
+ substractAmount(sign, 1, stored, ess);
+ stored.pay(player);
+ Trade.log("Sign", "Trade", "OwnerInteract", username, null, username, stored, sign.getBlock().getLocation(), ess);
+ }
+ catch (SignException e)
+ {
+ throw new SignException(Util.i18n("tradeSignEmptyOwner"));
+ }
}
else
{
@@ -141,7 +149,7 @@ public class SignTrade extends EssentialsSign
sign.setLine(index, stackamount + " " + split[1] + ":" + amount);
return;
}
- throw new SignException(Util.format("invalidSignLine", index+1));
+ throw new SignException(Util.format("invalidSignLine", index + 1));
}
protected final Trade getTrade(final ISign sign, final int index, final boolean fullAmount, final boolean notEmpty, final IEssentials ess) throws SignException
@@ -155,11 +163,18 @@ public class SignTrade extends EssentialsSign
if (split.length == 2)
{
- final Double money = getMoney(split[0]);
- final Double amount = notEmpty ? getDoublePositive(split[1]) : getDouble(split[1]);
- if (money != null && amount != null)
+ try
{
- return new Trade(fullAmount ? amount : money, ess);
+ final Double money = getMoney(split[0]);
+ final Double amount = notEmpty ? getDoublePositive(split[1]) : getDouble(split[1]);
+ if (money != null && amount != null)
+ {
+ return new Trade(fullAmount ? amount : money, ess);
+ }
+ }
+ catch (SignException e)
+ {
+ throw new SignException(Util.i18n("tradeSignEmpty"));
}
}
@@ -171,12 +186,12 @@ public class SignTrade extends EssentialsSign
amount -= amount % stackamount;
if (notEmpty && (amount < 1 || stackamount < 1 || item.getTypeId() == 0))
{
- throw new SignException(Util.i18n("moreThanZero"));
+ throw new SignException(Util.i18n("tradeSignEmpty"));
}
item.setAmount(fullAmount ? amount : stackamount);
return new Trade(item, ess);
}
- throw new SignException(Util.format("invalidSignLine", index+1));
+ throw new SignException(Util.format("invalidSignLine", index + 1));
}
protected final void substractAmount(final ISign sign, final int index, final Trade trade, final IEssentials ess) throws SignException
@@ -235,6 +250,6 @@ public class SignTrade extends EssentialsSign
sign.setLine(index, stackamount + " " + split[1] + ":" + (amount + Math.round(value)));
return;
}
- throw new SignException(Util.format("invalidSignLine", index+1));
+ throw new SignException(Util.format("invalidSignLine", index + 1));
}
}
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index fe4e63459..29ea5f50e 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -296,7 +296,8 @@ timeSetPermission = \u00a7cYou are not authorized to set the time.
timeWorldCurrent = The current time in {0} is \u00a73{1}
timeWorldSet = The time was set to {0} in: \u00a7c{1}
tradeCompleted = \u00a77Trade completed.
-tradeSignEmpty = The trade sign does not have enough supply left.
+tradeSignEmpty = The trade sign has nothing available for you.
+tradeSignEmptyOwner = There is nothing to collect from this trade sign.
treeFailure = \u00a7cTree generation failure. Try again on grass or dirt.
treeSpawned = \u00a77Tree spawned.
typeTpaccept = \u00a77To teleport, type \u00a7c/tpaccept\u00a77.
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index cacc9a86b..c73371f89 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -297,6 +297,7 @@ timeWorldCurrent = The current time in {0} is \u00a73{1}
timeWorldSet = The time was set to {0} in: \u00a7c{1}
tradeCompleted = \u00a77Forhandling fuldf\u00f8rt.
tradeSignEmpty = Forhandlings skiltet har ikke nok forsyning tilbage.
+tradeSignEmptyOwner = There is nothing to collect from this trade sign.
treeFailure = \u00a7cTr\u00e6 genererings fejl. Pr\u00f8v igen p\u00e5 gr\u00e6s eller jord.
treeSpawned = \u00a77Tr\u00e6 fremkaldt.
typeTpaccept = \u00a77For at teleportere, skriv \u00a7c/tpaccept\u00a77.
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index a4bcea0b2..58cf40708 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -297,6 +297,7 @@ timeWorldCurrent = The current time in {0} is \u00a73{1}
timeWorldSet = The time was set to {0} in: \u00a7c{1}
tradeCompleted = \u00a77Handel abgeschlossen.
tradeSignEmpty = Der Bestand des Trade-Schild ist aufgebraucht.
+tradeSignEmptyOwner = There is nothing to collect from this trade sign.
treeFailure = \u00a7cBaumpflanzung gescheitert. Versuche es auf Gras oder Dreck.
treeSpawned = \u00a77Baum gepflanzt.
typeTpaccept = \u00a77Um zu teleportieren, schreibe \u00a7c/tpaccept\u00a77.
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index 0c30aec96..c226901fb 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -297,6 +297,7 @@ timeWorldCurrent = The current time in {0} is \u00a73{1}
timeWorldSet = The time was set to {0} in: \u00a7c{1}
tradeCompleted = \u00a77Trade completed.
tradeSignEmpty = The trade sign does not have enough supply left.
+tradeSignEmptyOwner = There is nothing to collect from this trade sign.
treeFailure = \u00a7cTree generation failure. Try again on grass or dirt.
treeSpawned = \u00a77Tree spawned.
typeTpaccept = \u00a77To teleport, type \u00a7c/tpaccept\u00a77.
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index 1abae6fbc..51cc63509 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -297,6 +297,7 @@ timeWorldCurrent = The current time in {0} is \u00a73{1}
timeWorldSet = The time was set to {0} in: \u00a7c{1}
tradeCompleted = \u00a77\u00c9change termin\u00e9.
tradeSignEmpty = Le panneau de vente n''as pas encore assez de stock.
+tradeSignEmptyOwner = There is nothing to collect from this trade sign.
treeFailure = \u00a7cEchec de la g\u00e9n\u00e9ration de l''arbre. Essayez de nouveau sur de l''herbe ou de la terre.
treeSpawned = \u00a77Arbre cr\u00e9\u00e9.
typeTpaccept = \u00a77Pour le t\u00e9l\u00e9porter, tapez \u00a7c/tpaccept\u00a77.
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index dc41e499b..7e5b6e31f 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -297,6 +297,7 @@ timeWorldCurrent = The current time in {0} is \u00a73{1}
timeWorldSet = The time was set to {0} in: \u00a7c{1}
tradeCompleted = \u00a77Ruil verricht.
tradeSignEmpty = Het handelsbordje heeft een te kleine voorraad.
+tradeSignEmptyOwner = There is nothing to collect from this trade sign.
treeFailure = \u00a7cFout bij het genereren van boom. Pobeer het opnieuw op gras of dirt.
treeSpawned = \u00a77Boom gespawned.
typeTpaccept = \u00a77Om te teleporten, type \u00a7c/tpaccept\u00a77.