summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2011-08-20 21:58:26 +0100
committerKHobbits <rob@khobbits.co.uk>2011-08-20 21:58:26 +0100
commit83fc7de01a5a54182061681ee2f59a957e0da112 (patch)
tree7b661730056f106148bc60c02ecd0fce4033d7a6
parent69b76b810c1f327ee8726ee4b94079d974cfb665 (diff)
downloadEssentials-83fc7de01a5a54182061681ee2f59a957e0da112.tar
Essentials-83fc7de01a5a54182061681ee2f59a957e0da112.tar.gz
Essentials-83fc7de01a5a54182061681ee2f59a957e0da112.tar.lz
Essentials-83fc7de01a5a54182061681ee2f59a957e0da112.tar.xz
Essentials-83fc7de01a5a54182061681ee2f59a957e0da112.zip
Fixing trade message to be more user friendly.
-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 089d05670..964060099 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -291,7 +291,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 41b34ab0e..a94a04a33 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -292,6 +292,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 d85cd4350..1360bc3cc 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -292,6 +292,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 4c1ad26d4..0673d41ed 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -292,6 +292,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 0849c78d6..ea5af2d44 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -292,6 +292,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 a76084a55..3dbb00a74 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -292,6 +292,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.