mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-10 22:35:35 +00:00
Add new command /hat and update translate keys as well as fix colour codes.
This commit is contained in:
parent
409f337973
commit
0559b935e9
16 changed files with 128 additions and 7 deletions
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue