fix error when getting listener class on php 7

This commit is contained in:
Beu 2025-03-17 23:30:38 +01:00
parent b82dbe771b
commit c2b5f1bfec

View File

@ -43,7 +43,7 @@ class MatchManagerCore implements CallbackListener, CommandListener, TimerListen
* MARK: Constants
*/
const PLUGIN_ID = 152;
const PLUGIN_VERSION = 5.7;
const PLUGIN_VERSION = 5.8;
const PLUGIN_NAME = 'MatchManager Core';
const PLUGIN_AUTHOR = 'Beu';
@ -1083,7 +1083,7 @@ class MatchManagerCore implements CallbackListener, CommandListener, TimerListen
public function addCanStartFunction(CallbackListener $listener, string $method) {
if (!Listening::checkValidCallback($listener, $method)) return;
if (!array_key_exists($listener::class . "::" . $method, $this->canStartCallbacks)) {
if (!array_key_exists(get_class($listener) . "::" . $method, $this->canStartCallbacks)) {
$this->canStartCallbacks[] = new Listening($listener, $method);
}
}
@ -1094,7 +1094,7 @@ class MatchManagerCore implements CallbackListener, CommandListener, TimerListen
* @param string $method
*/
public function removeCanStartFunction(CallbackListener $listener, string $method) {
$name = $listener::class . "::" . $method;
$name = get_class($listener) . "::" . $method;
if (array_key_exists($name, $this->canStartCallbacks)) {
$this->canStartCallbacks = array_diff_key($this->canStartCallbacks, [$name]);
}