From 145a4fad0f539eb25ad24b89102921d6a0263b11 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 29 Mar 2018 11:45:06 +0100 Subject: [PATCH] CraftingManager: Make sort() static this doesn't need access to $this --- src/pocketmine/inventory/CraftingManager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/inventory/CraftingManager.php b/src/pocketmine/inventory/CraftingManager.php index 13edf466aa..6f491ac38b 100644 --- a/src/pocketmine/inventory/CraftingManager.php +++ b/src/pocketmine/inventory/CraftingManager.php @@ -144,7 +144,7 @@ class CraftingManager{ * * @return int */ - public function sort(Item $i1, Item $i2){ + public static function sort(Item $i1, Item $i2){ if($i1->getId() > $i2->getId()){ return 1; }elseif($i1->getId() < $i2->getId()){ @@ -212,7 +212,7 @@ class CraftingManager{ */ public function registerShapelessRecipe(ShapelessRecipe $recipe) : void{ $ingredients = $recipe->getIngredientList(); - usort($ingredients, [$this, "sort"]); + usort($ingredients, [self::class, "sort"]); $this->shapelessRecipes[json_encode($recipe->getResult())][json_encode($ingredients)] = $recipe; $this->craftingDataCache = null; } @@ -271,7 +271,7 @@ class CraftingManager{ if(isset($this->shapelessRecipes[$outputHash])){ $list = array_merge(...$inputMap); - usort($list, [$this, "sort"]); + usort($list, [self::class, "sort"]); $inputHash = json_encode($list); $recipe = $this->shapelessRecipes[$outputHash][$inputHash] ?? null;