Add new command /hat and update translate keys as well as fix colour codes.

This commit is contained in:
md_5 2012-05-27 17:24:49 +10:00
parent 409f337973
commit 0559b935e9
16 changed files with 128 additions and 7 deletions

View file

@ -0,0 +1,36 @@
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;
import org.bukkit.inventory.PlayerInventory;
public class Commandhat extends EssentialsCommand
{
public Commandhat()
{
super("hat");
}
@Override
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
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"));
}
else
{
user.sendMessage(_("hatFail"));
}
}
}