mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
PaintingMotive: fixed botched painting fix from 0ea3861d434b017055dfaac5c11e4c90f3779fac
I knew I should have used a singleton for this ...
This commit is contained in:
parent
5fd685e07d
commit
1584768c80
@ -30,6 +30,7 @@ class PaintingMotive{
|
||||
protected static $motives = [];
|
||||
|
||||
public static function init() : void{
|
||||
self::$initialized = true;
|
||||
foreach([
|
||||
new PaintingMotive(1, 1, "Alban"),
|
||||
new PaintingMotive(1, 1, "Aztec"),
|
||||
@ -67,10 +68,16 @@ class PaintingMotive{
|
||||
}
|
||||
|
||||
public static function registerMotive(PaintingMotive $motive) : void{
|
||||
if(!self::$initialized){
|
||||
self::init();
|
||||
}
|
||||
self::$motives[$motive->getName()] = $motive;
|
||||
}
|
||||
|
||||
public static function getMotiveByName(string $name) : ?PaintingMotive{
|
||||
if(!self::$initialized){
|
||||
self::init();
|
||||
}
|
||||
return self::$motives[$name] ?? null;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user