Remove dura command and merge into itemdb.

This commit is contained in:
KHobbits 2012-06-10 18:31:28 +01:00
parent 57c1d75779
commit 024aff0af5
3 changed files with 13 additions and 46 deletions

View File

@ -1,41 +0,0 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
public class Commanddurability extends EssentialsCommand
{
public int durability;
public int maxuses;
public Commanddurability()
{
super("durability");
}
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
ItemStack itemStack = user.getItemInHand();
maxuses = itemStack.getType().getMaxDurability();
durability = ((itemStack.getType().getMaxDurability() + 1) - itemStack.getDurability());
if (itemStack.getType() != Material.AIR)
{
if (maxuses != 0)
{
user.sendMessage(_("durability", Integer.toString(durability)));
}
else
{
user.sendMessage(_("noDurability"));
}
}
else
{
user.sendMessage(_("nothingInHand"));
}
}
}

View File

@ -1,5 +1,7 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -33,5 +35,15 @@ public class Commanditemdb extends EssentialsCommand
itemStack = ess.getItemDb().get(args[0]);
}
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

@ -79,10 +79,6 @@ commands:
description: States current depth, relative to sea level.
usage: /depth
aliases: [edepth]
durability:
description: Shows the uses an item has left.
usage: /<command>
aliases: [edura,dura,edurability]
eco:
description: Manages the server economy.
usage: /<command> <give|take|reset> <player> <amount>
@ -114,7 +110,7 @@ commands:
itemdb:
description: Searches for an item.
usage: /<command> <item>
aliases: [eitemdb]
aliases: [eitemdb,itemno,eitemno,durability,dura,edura,edurability]
fireball:
description: Throw a fireball.
usage: /<command> [small]