mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Enchantment: Create constant name once, and reuse it
this is more readable and more maintainable.
This commit is contained in:
parent
c2b0f6af22
commit
a842a5319f
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user