mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-03 12:31:46 +00:00
Wrap ItemDb accessors and move Item string matching to itemdb class.
This commit is contained in:
parent
fc63f63de6
commit
5eb3d9fa42
5 changed files with 67 additions and 50 deletions
|
@ -141,6 +141,42 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb
|
|||
retval.setDurability(metaData);
|
||||
return retval;
|
||||
}
|
||||
|
||||
public List<ItemStack> getMatching (User user, String[] args) throws Exception {
|
||||
List<ItemStack> is = new ArrayList<ItemStack>();
|
||||
|
||||
if (args[0].equalsIgnoreCase("hand"))
|
||||
{
|
||||
is.add(user.getItemInHand());
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("inventory") || args[0].equalsIgnoreCase("invent") || args[0].equalsIgnoreCase("all"))
|
||||
{
|
||||
for (ItemStack stack : user.getInventory().getContents())
|
||||
{
|
||||
if (stack == null || stack.getType() == Material.AIR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
is.add(stack);
|
||||
}
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("blocks"))
|
||||
{
|
||||
for (ItemStack stack : user.getInventory().getContents())
|
||||
{
|
||||
if (stack == null || stack.getTypeId() > 255 || stack.getType() == Material.AIR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
is.add(stack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
is.add(get(args[0]));
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
public String names(ItemStack item)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue