mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 16:29:40 +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\CommandSender;
|
||||||
use pocketmine\command\utils\InvalidCommandSyntaxException;
|
use pocketmine\command\utils\InvalidCommandSyntaxException;
|
||||||
use pocketmine\item\enchantment\Enchantment;
|
|
||||||
use pocketmine\item\enchantment\EnchantmentInstance;
|
use pocketmine\item\enchantment\EnchantmentInstance;
|
||||||
use pocketmine\item\enchantment\VanillaEnchantments;
|
use pocketmine\item\enchantment\VanillaEnchantments;
|
||||||
use pocketmine\lang\TranslationContainer;
|
use pocketmine\lang\TranslationContainer;
|
||||||
use pocketmine\utils\TextFormat;
|
use pocketmine\utils\TextFormat;
|
||||||
use function count;
|
use function count;
|
||||||
use function is_numeric;
|
|
||||||
|
|
||||||
class EnchantCommand extends VanillaCommand{
|
class EnchantCommand extends VanillaCommand{
|
||||||
|
|
||||||
@ -67,19 +65,11 @@ class EnchantCommand extends VanillaCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_numeric($args[1])){
|
try{
|
||||||
$enchantment = VanillaEnchantments::byMcpeId((int) $args[1]);
|
$enchantment = VanillaEnchantments::fromString($args[1]);
|
||||||
if(!($enchantment instanceof Enchantment)){
|
}catch(\InvalidArgumentException $e){
|
||||||
$sender->sendMessage(new TranslationContainer("commands.enchant.notFound", [$args[1]]));
|
$sender->sendMessage(new TranslationContainer("commands.enchant.notFound", [$args[1]]));
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}else{
|
|
||||||
try{
|
|
||||||
$enchantment = VanillaEnchantments::fromString($args[1]);
|
|
||||||
}catch(\InvalidArgumentException $e){
|
|
||||||
$sender->sendMessage(new TranslationContainer("commands.enchant.notFound", [$args[1]]));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$level = 1;
|
$level = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user