summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2011-10-26 03:05:09 +0100
committerKHobbits <rob@khobbits.co.uk>2011-10-26 03:05:09 +0100
commitdc2e23c85ae9647519938602a59328ddb12ac9dd (patch)
tree565699e411c5409fcc6c73ac595d999f2bb69102
parent5a54ef355f07f9a0cc2a825dc41966c49f731181 (diff)
downloadEssentials-dc2e23c85ae9647519938602a59328ddb12ac9dd.tar
Essentials-dc2e23c85ae9647519938602a59328ddb12ac9dd.tar.gz
Essentials-dc2e23c85ae9647519938602a59328ddb12ac9dd.tar.lz
Essentials-dc2e23c85ae9647519938602a59328ddb12ac9dd.tar.xz
Essentials-dc2e23c85ae9647519938602a59328ddb12ac9dd.zip
Improved readability of /sell
~translations need checking~
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsell.java49
-rw-r--r--Essentials/src/messages.properties4
-rw-r--r--Essentials/src/messages_da.properties4
-rw-r--r--Essentials/src/messages_de.properties2
-rw-r--r--Essentials/src/messages_en.properties4
-rw-r--r--Essentials/src/messages_fr.properties4
-rw-r--r--Essentials/src/messages_nl.properties4
7 files changed, 35 insertions, 36 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java
index 658782b9a..d0b996917 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java
@@ -103,28 +103,21 @@ public class Commandsell extends EssentialsCommand
int max = 0;
- if (!isBulkSell)
+ for (ItemStack s : user.getInventory().getContents())
{
- for (ItemStack s : user.getInventory().getContents())
+ if (s == null)
{
- if (s == null)
- {
- continue;
- }
- if (s.getTypeId() != is.getTypeId())
- {
- continue;
- }
- if (s.getDurability() != is.getDurability())
- {
- continue;
- }
- max += s.getAmount();
+ continue;
}
- }
- else
- {
- max += is.getAmount();
+ if (s.getTypeId() != is.getTypeId())
+ {
+ continue;
+ }
+ if (s.getDurability() != is.getDurability())
+ {
+ continue;
+ }
+ max += s.getAmount();
}
if (stack)
@@ -140,20 +133,26 @@ public class Commandsell extends EssentialsCommand
{
amount -= amount % 64;
}
-
if (amount > max || amount < 1)
{
- user.sendMessage(Util.i18n("itemNotEnough1"));
- user.sendMessage(Util.i18n("itemNotEnough2"));
- throw new Exception(Util.i18n("itemNotEnough3"));
+ if (!isBulkSell)
+ {
+ user.sendMessage(Util.i18n("itemNotEnough1"));
+ user.sendMessage(Util.i18n("itemNotEnough2"));
+ throw new Exception(Util.i18n("itemNotEnough3"));
+ }
+ else
+ {
+ return;
+ }
}
final ItemStack ris = new ItemStack(is.getType(), amount, is.getDurability());
InventoryWorkaround.removeItem(user.getInventory(), true, ris);
user.updateInventory();
- Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(worth*amount, ess), user.getLocation(), ess);
+ Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(worth * amount, ess), user.getLocation(), ess);
user.giveMoney(worth * amount);
- user.sendMessage(Util.format("itemSold", Util.formatCurrency(worth * amount, ess), amount, Util.formatCurrency(worth, ess)));
+ user.sendMessage(Util.format("itemSold", Util.formatCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(), Util.formatCurrency(worth, ess)));
logger.log(Level.INFO, Util.format("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(), Util.formatCurrency(worth * amount, ess), amount, Util.formatCurrency(worth, ess)));
}
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index 0eb9f9d37..c3019473c 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -127,8 +127,8 @@ itemNotEnough1 = \u00a7cYou do not have enough of that item to sell.
itemNotEnough2 = \u00a77If you meant to sell all of your items of that type, use /sell itemname
itemNotEnough3 = \u00a77/sell itemname -1 will sell all but one item, etc.
itemSellAir = You really tried to sell Air? Put an item in your hand.
-itemSold = \u00a77Sold for \u00a7c {0} \u00a77 ({1} items at {2} each)
-itemSoldConsole = {0} sold {1} for \u00a77 {2} \u00a77 ({3} items at {4} each)
+itemSold = \u00a77Sold for \u00a7c{0} \u00a77({1} {2} at {3} each)
+itemSoldConsole = {0} sold {1} for \u00a77{2} \u00a77({3} items at {4} each)
itemSpawn = \u00a77Giving {0} of {1}
itemsCsvNotLoaded = Could not load items.csv.
jailAlreadyIncarcerated = \u00a7cPerson is already in jail: {0}
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index 7526e4858..5ca3048b6 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -127,8 +127,8 @@ itemNotEnough1 = \u00a7cDu har ikke nok af det element til at s\u00e6lge.
itemNotEnough2 = \u00a77Hvis du ville have solgt alle dine elementer af den type, brug /sell elementnavn
itemNotEnough3 = \u00a77/sell elementnavn -1 vil s\u00e6lge alle p\u00e5 n\u00e6r et element, osv.
itemSellAir = Fors\u00f8gte du virkelig at s\u00e6lge luft? Kom et element i din h\u00e5nd.
-itemSold = \u00a77Solgte for \u00a7c {0} \u00a77 ({1} elementer for {2} hver)
-itemSoldConsole = {0} solgte {1} for \u00a77 {2} \u00a77 ({3} elementer for {4} hver)
+itemSold = \u00a77Solgte for \u00a7c{0} \u00a77({1} {2} elementer for {3} hver)
+itemSoldConsole = {0} solgte {1} for \u00a77{2} \u00a77({3} elementer for {4} hver)
itemSpawn = \u00a77Giver {0} af {1}
itemsCsvNotLoaded = Kunne ikke indl\u00e6se items.csv.
jailAlreadyIncarcerated = \u00a7cPerson is already in jail: {0}
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index 5ccedd370..da78e0778 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -127,7 +127,7 @@ itemNotEnough1 = \u00a7cDu hast nicht genug Gegenst\u00e4nde zum Verkaufen.
itemNotEnough2 = \u00a77Wenn du alles verkaufen willst, nutze /sell itemname
itemNotEnough3 = \u00a77/sell itemname -1 verkauft alles bis auf eins usw.
itemSellAir = Du versuchst Luft zu verkaufen? Nimm einen Gegenstand in die Hand.
-itemSold = \u00a77Verkauft f\u00fcr \u00a7c{0}\u00a77 ({1} Einheiten je {2})
+itemSold = \u00a77Verkauft f\u00fcr \u00a7c{0}\u00a77 ({1} {2} Einheiten je {3})
itemSoldConsole = {0} verkauft {1} f\u00fcr \u00a77{2}\u00a77 ({3} Einheiten je {4})
itemSpawn = \u00a77Gebe {0}x {1}
itemsCsvNotLoaded = Konnte items.csv nicht laden.
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index 39fe33d83..144d1ec72 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -127,8 +127,8 @@ itemNotEnough1 = \u00a7cYou do not have enough of that item to sell.
itemNotEnough2 = \u00a77If you meant to sell all of your items of that type, use /sell itemname
itemNotEnough3 = \u00a77/sell itemname -1 will sell all but one item, etc.
itemSellAir = You really tried to sell Air? Put an item in your hand.
-itemSold = \u00a77Sold for \u00a7c {0} \u00a77 ({1} items at {2} each)
-itemSoldConsole = {0} sold {1} for \u00a77 {2} \u00a77 ({3} items at {4} each)
+itemSold = \u00a77Sold for \u00a7c{0} \u00a77({1} {2} at {3} each)
+itemSoldConsole = {0} sold {1} for \u00a77{2} \u00a77({3} items at {4} each)
itemSpawn = \u00a77Giving {0} of {1}
itemsCsvNotLoaded = Could not load items.csv.
jailAlreadyIncarcerated = \u00a7cPerson is already in jail: {0}
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index 11fa2e6a4..7fd1cd910 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -127,8 +127,8 @@ itemNotEnough1 = \u00a7cVous n''avez pas assez de cet objet pour le vendre.
itemNotEnough2 = \u00a77Si vous voulez vendre l''int\u00e9gralit\u00e9 de vos objets de ce type l\u00e0, utilisez /sell nomObjet
itemNotEnough3 = \u00a77/sell nomObjet -1 vendra tout sauf un objet, etc.
itemSellAir = Vous vouliez vraiment vendre de l''air? Mettez un objet dans votre main.
-itemSold = \u00a77Vendu pour \u00a7c {0} \u00a77 ({1} objet(s) \u00e0 {2} chacun)
-itemSoldConsole = {0} vendu {1} pour \u00a77 {2} \u00a77 ({3} objet(s) \u00e0 {4} chacun)
+itemSold = \u00a77Vendu pour \u00a7c{0} \u00a77({1} {2} \u00e0 {3} chacun)
+itemSoldConsole = {0} vendu {1} pour \u00a77{2} \u00a77({3} objet(s) \u00e0 {4} chacun)
itemSpawn = \u00a77Donne {0} de {1}
itemsCsvNotLoaded = N''a pas pu charger items.csv.
jailAlreadyIncarcerated = \u00a7cPerson is already in jail: {0}
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index c3ce54543..e12fc07b8 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -127,8 +127,8 @@ itemNotEnough1 = \u00a7cJe hebt niet genoeg van dat voorwerp om te verkopen.
itemNotEnough2 = \u00a77Type /sell itemname Als je alles daarvan wilt verkopen
itemNotEnough3 = \u00a77/sell itemname -1 zorgt ervoor dat ze allemaal behalve 1 worden verkocht, etc.
itemSellAir = Je wilde serieus lucht verkopen? Plaats een voorwerp in je hand.
-itemSold = \u00a77Verkocht voor \u00a7c {0} \u00a77 ({1} voorwerpen voor {2} per stuk)
-itemSoldConsole = {0} verkocht {1} voor \u00a77 {2} \u00a77 ({3} voorwerpen voor {4} per stuk)
+itemSold = \u00a77Verkocht voor \u00a7c{0} \u00a77({1} {2} voorwerpen voor {3} per stuk)
+itemSoldConsole = {0} verkocht {1} voor \u00a77{2} \u00a77({3} voorwerpen voor {4} per stuk)
itemSpawn = \u00a77Geeft {0} {1}
itemsCsvNotLoaded = De item kunnen niet geladen worden.csv.
jailAlreadyIncarcerated = \u00a7cPerson is already in jail: {0}