Improved readability of /sell

~translations need checking~
This commit is contained in:
KHobbits 2011-10-26 03:05:09 +01:00
parent 5a54ef355f
commit dc2e23c85a
7 changed files with 35 additions and 36 deletions

View File

@ -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)));
}

View File

@ -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}

View File

@ -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}

View File

@ -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.

View File

@ -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}

View File

@ -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}

View File

@ -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}