From 1584768c80f519b50b8dad96393c1a1ac6ce1382 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 7 Jun 2022 15:48:20 +0100 Subject: [PATCH] PaintingMotive: fixed botched painting fix from 0ea3861d434b017055dfaac5c11e4c90f3779fac I knew I should have used a singleton for this ... --- src/entity/object/PaintingMotive.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/entity/object/PaintingMotive.php b/src/entity/object/PaintingMotive.php index 719ae2583..ecbc478a5 100644 --- a/src/entity/object/PaintingMotive.php +++ b/src/entity/object/PaintingMotive.php @@ -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; }