mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 13:25:16 +00:00
Moved CraftingManager init to its own function
this allows the crafting manager to be re-initialized on the fly without recreating it.
This commit is contained in:
parent
1f4f8ab3f0
commit
a6d7365a28
@ -30,7 +30,6 @@ use pocketmine\network\mcpe\protocol\CraftingDataPacket;
|
|||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
use pocketmine\timings\Timings;
|
use pocketmine\timings\Timings;
|
||||||
use pocketmine\utils\Config;
|
use pocketmine\utils\Config;
|
||||||
use pocketmine\utils\MainLogger;
|
|
||||||
use pocketmine\utils\UUID;
|
use pocketmine\utils\UUID;
|
||||||
|
|
||||||
class CraftingManager{
|
class CraftingManager{
|
||||||
@ -51,9 +50,12 @@ class CraftingManager{
|
|||||||
private $craftingDataCache;
|
private $craftingDataCache;
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
|
$this->init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function init() : void{
|
||||||
$recipes = new Config(\pocketmine\RESOURCE_PATH . "recipes.json", Config::JSON, []);
|
$recipes = new Config(\pocketmine\RESOURCE_PATH . "recipes.json", Config::JSON, []);
|
||||||
|
|
||||||
MainLogger::getLogger()->info("Loading recipes...");
|
|
||||||
foreach($recipes->getAll() as $recipe){
|
foreach($recipes->getAll() as $recipe){
|
||||||
switch($recipe["type"]){
|
switch($recipe["type"]){
|
||||||
case 0:
|
case 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user