mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-25 02:27:33 +01:00
Fix /itemdb showing 'uses left' on none held items.
This commit is contained in:
parent
427108574e
commit
ecd96a81dd
@ -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…
Reference in New Issue
Block a user