mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-17 12:01:20 +02:00
[trunk] fix /sell inventory / blocks chat spam
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1363 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
@@ -34,7 +34,7 @@ public class Commandsell extends EssentialsCommand
|
|||||||
for (ItemStack stack : user.getInventory().getContents())
|
for (ItemStack stack : user.getInventory().getContents())
|
||||||
{
|
{
|
||||||
if (stack == null || stack.getType() == Material.AIR) continue;
|
if (stack == null || stack.getType() == Material.AIR) continue;
|
||||||
sellItem(user, stack, args);
|
sellItem(user, stack, args, true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ public class Commandsell extends EssentialsCommand
|
|||||||
for (ItemStack stack : user.getInventory().getContents())
|
for (ItemStack stack : user.getInventory().getContents())
|
||||||
{
|
{
|
||||||
if (stack == null || stack.getTypeId() > 255 || stack.getType() == Material.AIR) continue;
|
if (stack == null || stack.getTypeId() > 255 || stack.getType() == Material.AIR) continue;
|
||||||
sellItem(user, stack, args);
|
sellItem(user, stack, args, true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -51,10 +51,10 @@ public class Commandsell extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
is = ItemDb.get(args[0]);
|
is = ItemDb.get(args[0]);
|
||||||
}
|
}
|
||||||
sellItem(user, is, args);
|
sellItem(user, is, args, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sellItem(User user, ItemStack is, String[] args) throws Exception
|
private void sellItem(User user, ItemStack is, String[] args, boolean isBulkSell) throws Exception
|
||||||
{
|
{
|
||||||
if (is == null || is.getType() == Material.AIR)
|
if (is == null || is.getType() == Material.AIR)
|
||||||
{
|
{
|
||||||
@@ -83,7 +83,10 @@ public class Commandsell extends EssentialsCommand
|
|||||||
throw new Exception("Item must be traded in stacks. A quantity of 2s would be two stacks, etc.");
|
throw new Exception("Item must be traded in stacks. A quantity of 2s would be two stacks, etc.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int max = 0;
|
int max = 0;
|
||||||
|
if (!isBulkSell)
|
||||||
|
{
|
||||||
for (ItemStack s : user.getInventory().getContents())
|
for (ItemStack s : user.getInventory().getContents())
|
||||||
{
|
{
|
||||||
if (s == null)
|
if (s == null)
|
||||||
@@ -100,6 +103,11 @@ public class Commandsell extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
max += s.getAmount();
|
max += s.getAmount();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
max += is.getAmount();
|
||||||
|
}
|
||||||
|
|
||||||
if (stack)
|
if (stack)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user