mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-10 15:59:39 +00:00
EnchantCommand no longer accepts numeric enchantment IDs
This commit is contained in:
parent
3b632a8deb
commit
2e1239f77a
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user