Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [...]
- log.info(plugin.getName() + ": Permissions plugin not found. " + plugin.getName() + " will work for everyone.");
- [...]
- @Override
- public boolean onCommand(CommandSender sender, Command cmd,
- String commandLabel, String[] args) {
- Player player = (Player) sender;
- if (commandLabel.equalsIgnoreCase("hat")) {
- if (Permissions == null || Permissions.has(player, "simple.hat")) {
- if (player.getItemInHand().getTypeId() == 0) {
- player.sendMessage(ChatColor.YELLOW
- + "You must have something to put on your head.");
- return true;
- } else {
- ItemStack itemHand = player.getItemInHand();
- PlayerInventory inventory = player.getInventory();
- ItemStack itemHead = inventory.getHelmet();
- inventory.remove(itemHand);
- inventory.setHelmet(itemHand);
- if (itemHead.getTypeId() != 0) {
- inventory.setItemInHand(itemHead);
- }
- player.sendMessage(ChatColor.YELLOW + "Item successfuly put on your head.");
- return true;
- }
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement