54 $player = $this->fetchPermittedPlayerTarget($sender, $args[0], DefaultPermissionNames::COMMAND_ENCHANT_SELF, DefaultPermissionNames::COMMAND_ENCHANT_OTHER);
59 $item = $player->getInventory()->getItemInHand();
62 $sender->sendMessage(KnownTranslationFactory::commands_enchant_noItem());
66 $enchantment = StringToEnchantmentParser::getInstance()->parse($args[1]);
67 if($enchantment ===
null){
68 $sender->sendMessage(KnownTranslationFactory::commands_enchant_notFound($args[1]));
74 $level = $this->getBoundedInt($sender, $args[2], 1, $enchantment->getMaxLevel());
82 $player->getInventory()->setItemInHand($enchantedItem);
84 self::broadcastCommandMessage($sender, KnownTranslationFactory::commands_enchant_success($player->getName()));