mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-09-12 05:08:48 +00:00
added /dura a durability check
This commit is contained in:
parent
45c1e347b0
commit
96eb9c5db7
|
@ -0,0 +1,42 @@
|
|||
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;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Commanddurability extends EssentialsCommand
|
||||
{
|
||||
public int durability;
|
||||
public int maxuses;
|
||||
|
||||
public Commanddurability()
|
||||
{
|
||||
super("durability");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
ItemStack itemStack = ((Player)sender).getItemInHand();
|
||||
maxuses = itemStack.getType().getMaxDurability();
|
||||
durability = ((itemStack.getType().getMaxDurability() + 1) - itemStack.getDurability());
|
||||
if (itemStack.getType() != Material.AIR)
|
||||
{
|
||||
if (maxuses != 0)
|
||||
{
|
||||
sender.sendMessage(_("durability", Integer.toString(durability)));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(_("notATool"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(_("nothingInHand"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -73,6 +73,7 @@ disabledToSpawnMob=Spawning this mob was disabled in the config file.
|
|||
dontMoveMessage=\u00a77Teleportation will commence in {0}. Don''t move.
|
||||
downloadingGeoIp=Downloading GeoIP database ... this might take a while (country: 0.6 MB, city: 20MB)
|
||||
duplicatedUserdata=Duplicated userdata: {0} and {1}
|
||||
durability=\u00a77This tool has \u00a7c{0}\u00a77 uses left
|
||||
enableUnlimited=\u00a77Giving unlimited amount of {0} to {1}.
|
||||
enabled=enabled
|
||||
enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand.
|
||||
|
@ -247,6 +248,7 @@ noWarpsDefined=No warps defined
|
|||
none=none
|
||||
notAllowedToQuestion=\u00a7cYou are not authorized to use question.
|
||||
notAllowedToShout=\u00a7cYou are not authorized to shout.
|
||||
notATool=\u00a7cThis item is not a tool.
|
||||
notEnoughExperience=You do not have enough experience.
|
||||
notEnoughMoney=You do not have sufficient funds.
|
||||
notRecommendedBukkit= * ! * Bukkit version is not the recommended build for Essentials.
|
||||
|
|
|
@ -79,6 +79,10 @@ 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: [dura]
|
||||
eco:
|
||||
description: Manages the server economy.
|
||||
usage: /<command> <give|take|reset> <player> <amount>
|
||||
|
|
Loading…
Reference in a new issue