mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-31 01:43:20 +00:00
Fix /itemdb showing 'uses left' on none held items.
This commit is contained in:
parent
427108574e
commit
ecd96a81dd
1 changed files with 3 additions and 1 deletions
|
@ -19,10 +19,12 @@ public class Commanditemdb extends EssentialsCommand
|
|||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
ItemStack itemStack = null;
|
||||
boolean itemHeld = false;
|
||||
if (args.length < 1)
|
||||
{
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
itemHeld = true;
|
||||
itemStack = ((Player)sender).getItemInHand();
|
||||
}
|
||||
if (itemStack == null)
|
||||
|
@ -36,7 +38,7 @@ public class Commanditemdb extends EssentialsCommand
|
|||
}
|
||||
sender.sendMessage(itemStack.getType().toString() + "- " + itemStack.getTypeId() + ":" + Integer.toString(itemStack.getDurability()));
|
||||
|
||||
if (itemStack.getType() != Material.AIR)
|
||||
if (itemHeld && itemStack.getType() != Material.AIR)
|
||||
{
|
||||
int maxuses = itemStack.getType().getMaxDurability();
|
||||
int durability = ((maxuses + 1) - itemStack.getDurability());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue