diff --git a/src/command/defaults/EnchantCommand.php b/src/command/defaults/EnchantCommand.php index 89a252fcb..8ae0d43d1 100644 --- a/src/command/defaults/EnchantCommand.php +++ b/src/command/defaults/EnchantCommand.php @@ -25,13 +25,11 @@ namespace pocketmine\command\defaults; use pocketmine\command\CommandSender; use pocketmine\command\utils\InvalidCommandSyntaxException; -use pocketmine\item\enchantment\Enchantment; use pocketmine\item\enchantment\EnchantmentInstance; use pocketmine\item\enchantment\VanillaEnchantments; use pocketmine\lang\TranslationContainer; use pocketmine\utils\TextFormat; use function count; -use function is_numeric; class EnchantCommand extends VanillaCommand{ @@ -67,19 +65,11 @@ class EnchantCommand extends VanillaCommand{ return true; } - if(is_numeric($args[1])){ - $enchantment = VanillaEnchantments::byMcpeId((int) $args[1]); - if(!($enchantment instanceof Enchantment)){ - $sender->sendMessage(new TranslationContainer("commands.enchant.notFound", [$args[1]])); - return true; - } - }else{ - try{ - $enchantment = VanillaEnchantments::fromString($args[1]); - }catch(\InvalidArgumentException $e){ - $sender->sendMessage(new TranslationContainer("commands.enchant.notFound", [$args[1]])); - return true; - } + try{ + $enchantment = VanillaEnchantments::fromString($args[1]); + }catch(\InvalidArgumentException $e){ + $sender->sendMessage(new TranslationContainer("commands.enchant.notFound", [$args[1]])); + return true; } $level = 1;