mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-15 02:59:06 +02:00
Fix /itemdb showing 'uses left' on none held items.
This commit is contained in:
@@ -19,10 +19,12 @@ public class Commanditemdb extends EssentialsCommand
|
|||||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
ItemStack itemStack = null;
|
ItemStack itemStack = null;
|
||||||
|
boolean itemHeld = false;
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
|
itemHeld = true;
|
||||||
itemStack = ((Player)sender).getItemInHand();
|
itemStack = ((Player)sender).getItemInHand();
|
||||||
}
|
}
|
||||||
if (itemStack == null)
|
if (itemStack == null)
|
||||||
@@ -36,7 +38,7 @@ public class Commanditemdb extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
sender.sendMessage(itemStack.getType().toString() + "- " + itemStack.getTypeId() + ":" + Integer.toString(itemStack.getDurability()));
|
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 maxuses = itemStack.getType().getMaxDurability();
|
||||||
int durability = ((maxuses + 1) - itemStack.getDurability());
|
int durability = ((maxuses + 1) - itemStack.getDurability());
|
||||||
|
Reference in New Issue
Block a user