1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-24 15:23:20 +02:00

Itemdb shows durability of item in hand

This commit is contained in:
ementalo
2012-06-18 10:22:28 +01:00
parent 330c7271a7
commit cc02df0f78
2 changed files with 13 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import org.bukkit.Material;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@@ -27,5 +29,15 @@ public class Commanditemdb extends EssentialsCommand
itemStack = ess.getItemDb().get(args[0]); itemStack = ess.getItemDb().get(args[0]);
} }
sender.sendMessage(itemStack.getType().toString() + "- " + itemStack.getTypeId() + ":" + Integer.toString(itemStack.getData().getData())); sender.sendMessage(itemStack.getType().toString() + "- " + itemStack.getTypeId() + ":" + Integer.toString(itemStack.getData().getData()));
int maxuses = itemStack.getType().getMaxDurability();
int durability = ((itemStack.getType().getMaxDurability() + 1) - itemStack.getDurability());
if (itemStack.getType() != Material.AIR)
{
if (maxuses != 0)
{
sender.sendMessage(_("durability", Integer.toString(durability)));
}
}
} }
} }

View File

@@ -110,7 +110,7 @@ commands:
itemdb: itemdb:
description: Searches for an item. description: Searches for an item.
usage: /<command> <item> usage: /<command> <item>
aliases: [eitemdb] aliases: [eitemdb,itemno,eitemno,durability,dura,edura,edurability]
fireball: fireball:
description: Throw a fireball. description: Throw a fireball.
usage: /<command> [small] usage: /<command> [small]