PocketMine-MP 5.19.1 git-5cc1068cd43264d3363295eb8d6901e02f467897
StringToEnchantmentParser.php
1<?php
2
3/*
4 *
5 * ____ _ _ __ __ _ __ __ ____
6 * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8 * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9 * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * @author PocketMine Team
17 * @link http://www.pocketmine.net/
18 *
19 *
20 */
21
22declare(strict_types=1);
23
24namespace pocketmine\item\enchantment;
25
26use pocketmine\utils\SingletonTrait;
28
35 use SingletonTrait;
36
37 private static function make() : self{
38 $result = new self();
39
40 $result->register("blast_protection", fn() => VanillaEnchantments::BLAST_PROTECTION());
41 $result->register("efficiency", fn() => VanillaEnchantments::EFFICIENCY());
42 $result->register("feather_falling", fn() => VanillaEnchantments::FEATHER_FALLING());
43 $result->register("fire_aspect", fn() => VanillaEnchantments::FIRE_ASPECT());
44 $result->register("fire_protection", fn() => VanillaEnchantments::FIRE_PROTECTION());
45 $result->register("flame", fn() => VanillaEnchantments::FLAME());
46 $result->register("fortune", fn() => VanillaEnchantments::FORTUNE());
47 $result->register("infinity", fn() => VanillaEnchantments::INFINITY());
48 $result->register("knockback", fn() => VanillaEnchantments::KNOCKBACK());
49 $result->register("mending", fn() => VanillaEnchantments::MENDING());
50 $result->register("power", fn() => VanillaEnchantments::POWER());
51 $result->register("projectile_protection", fn() => VanillaEnchantments::PROJECTILE_PROTECTION());
52 $result->register("protection", fn() => VanillaEnchantments::PROTECTION());
53 $result->register("punch", fn() => VanillaEnchantments::PUNCH());
54 $result->register("respiration", fn() => VanillaEnchantments::RESPIRATION());
55 $result->register("sharpness", fn() => VanillaEnchantments::SHARPNESS());
56 $result->register("silk_touch", fn() => VanillaEnchantments::SILK_TOUCH());
57 $result->register("swift_sneak", fn() => VanillaEnchantments::SWIFT_SNEAK());
58 $result->register("thorns", fn() => VanillaEnchantments::THORNS());
59 $result->register("unbreaking", fn() => VanillaEnchantments::UNBREAKING());
60 $result->register("vanishing", fn() => VanillaEnchantments::VANISHING());
61
62 return $result;
63 }
64
65 public function parse(string $input) : ?Enchantment{
66 return parent::parse($input);
67 }
68}