Don't allow armor to be used as a hat.

This commit is contained in:
md_5 2012-05-27 17:36:04 +10:00
parent 0559b935e9
commit 45c1e347b0
12 changed files with 22 additions and 6 deletions

View File

@ -21,12 +21,17 @@ public class Commandhat extends EssentialsCommand
if (user.getItemInHand().getType() != Material.AIR)
{
final ItemStack hand = user.getItemInHand();
final PlayerInventory inv = user.getInventory();
final ItemStack head = inv.getHelmet();
inv.removeItem(hand);
inv.setHelmet(hand);
inv.setItemInHand(head);
user.sendMessage(_("hatPlaced"));
if (hand.getType().getMaxDurability() == 0)
{
final PlayerInventory inv = user.getInventory();
final ItemStack head = inv.getHelmet();
inv.removeItem(hand);
inv.setHelmet(hand);
inv.setItemInHand(head);
user.sendMessage(_("hatPlaced"));
} else {
user.sendMessage(_("hatArmor"));
}
}
else
{

View File

@ -431,3 +431,4 @@ year=year
years=years
youAreHealed=\u00a77You have been healed.
youHaveNewMail=\u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail.
hatArmor=\u00a7cError, you cannot use armor as a hat!

View File

@ -434,3 +434,4 @@ vanished=\u00a7aYou have now been vanished.
tps=Current TPS = {0}
hatPlaced=\u00a7eEnjoy your new hat!
hatFail=\u00a7cYou must have something to wear in your hand.
hatArmor=\u00a7cError, you cannot use armor as a hat!

View File

@ -431,3 +431,4 @@ vanished=\u00a7aYou have now been vanished.
tps=Current TPS = {0}
hatPlaced=\u00a7eEnjoy your new hat!
hatFail=\u00a7cYou must have something to wear in your hand.
hatArmor=\u00a7cError, you cannot use armor as a hat!

View File

@ -431,3 +431,4 @@ vanished=\u00a7aYou have now been vanished.
tps=Current TPS = {0}
hatPlaced=\u00a7eEnjoy your new hat!
hatFail=\u00a7cYou must have something to wear in your hand.
hatArmor=\u00a7cError, you cannot use armor as a hat!

View File

@ -431,3 +431,4 @@ year=year
years=years
youAreHealed=\u00a77You have been healed.
youHaveNewMail=\u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail.
hatArmor=\u00a7cError, you cannot use armor as a hat!

View File

@ -431,3 +431,4 @@ vanished=\u00a7aYou have now been vanished.
tps=Current TPS = {0}
hatPlaced=\u00a7eEnjoy your new hat!
hatFail=\u00a7cYou must have something to wear in your hand.
hatArmor=\u00a7cError, you cannot use armor as a hat!

View File

@ -431,3 +431,4 @@ vanished=\u00a7aYou have now been vanished.
tps=Current TPS = {0}
hatPlaced=\u00a7eEnjoy your new hat!
hatFail=\u00a7cYou must have something to wear in your hand.
hatArmor=\u00a7cError, you cannot use armor as a hat!

View File

@ -431,3 +431,4 @@ vanished=\u00a7aYou have now been vanished.
tps=Current TPS = {0}
hatPlaced=\u00a7eEnjoy your new hat!
hatFail=\u00a7cYou must have something to wear in your hand.
hatArmor=\u00a7cError, you cannot use armor as a hat!

View File

@ -431,3 +431,4 @@ vanished=\u00a7aYou have now been vanished.
tps=Current TPS = {0}
hatPlaced=\u00a7eEnjoy your new hat!
hatFail=\u00a7cYou must have something to wear in your hand.
hatArmor=\u00a7cError, you cannot use armor as a hat!

View File

@ -431,3 +431,4 @@ vanished=\u00a7aYou have now been vanished.
tps=Current TPS = {0}
hatPlaced=\u00a7eEnjoy your new hat!
hatFail=\u00a7cYou must have something to wear in your hand.
hatArmor=\u00a7cError, you cannot use armor as a hat!

View File

@ -431,3 +431,4 @@ vanished=\u00a7aYou have now been vanished.
tps=Current TPS = {0}
hatPlaced=\u00a7eEnjoy your new hat!
hatFail=\u00a7cYou must have something to wear in your hand.
hatArmor=\u00a7cError, you cannot use armor as a hat!