mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Enchantment: Create constant name once, and reuse it
this is more readable and more maintainable.
This commit is contained in:
@ -116,8 +116,9 @@ class Enchantment{
|
||||
* @return Enchantment|null
|
||||
*/
|
||||
public static function getEnchantmentByName(string $name){
|
||||
if(defined(Enchantment::class . "::" . strtoupper($name))){
|
||||
return self::getEnchantment(constant(Enchantment::class . "::" . strtoupper($name)));
|
||||
$const = Enchantment::class . "::" . strtoupper($name);
|
||||
if(defined($const)){
|
||||
return self::getEnchantment(constant($const));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user