From 5b330d57533a5749f0287793308fce119b7ff15b Mon Sep 17 00:00:00 2001 From: kremsy Date: Fri, 7 Apr 2017 18:37:08 +0200 Subject: [PATCH] Small Fix + Test Test/Usage example: $this->getShootmaniaScores()->setCallable(function(OnScoresStructure $scores){ $scores->getUsageInformation(); }); --- core/Script/InvokeScriptCallback.php | 10 ++++++++-- core/Script/ModeScriptEventManager.php | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/Script/InvokeScriptCallback.php b/core/Script/InvokeScriptCallback.php index 104aa1c3..e9607fc2 100644 --- a/core/Script/InvokeScriptCallback.php +++ b/core/Script/InvokeScriptCallback.php @@ -8,7 +8,13 @@ use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure; use ManiaControl\General\UsageInformationAble; use ManiaControl\General\UsageInformationTrait; -//TODO test +/** + * Class For Invoking Callbacks on Script Methods + * + * @author ManiaControl Team + * @copyright 2014-2017 ManiaControl Team + * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 + */ class InvokeScriptCallback implements CallbackListener, UsageInformationAble { use UsageInformationTrait; @@ -40,7 +46,7 @@ class InvokeScriptCallback implements CallbackListener, UsageInformationAble { */ public function setCallable(callable $function) { $this->maniaControl->getCallbackManager()->registerCallbackListener($this->callbackName, $this, function(BaseResponseStructure $callBackData) use (&$function){ - if($callBackData == $this->responseId){ + if($callBackData->getResponseId() == $this->responseId){ call_user_func_array($function, array($callBackData)); } }); diff --git a/core/Script/ModeScriptEventManager.php b/core/Script/ModeScriptEventManager.php index 24ad5ba7..c56ab225 100644 --- a/core/Script/ModeScriptEventManager.php +++ b/core/Script/ModeScriptEventManager.php @@ -3,6 +3,7 @@ namespace ManiaControl\Script; use ManiaControl\Callbacks\Callbacks; +use ManiaControl\Callbacks\Structures\ShootMania\OnScoresStructure; use ManiaControl\General\UsageInformationAble; use ManiaControl\General\UsageInformationTrait; use ManiaControl\ManiaControl;