V
V
va1errr2020-04-25 15:04:02
PHP
va1errr, 2020-04-25 15:04:02

"Call to a member function createSimpleForm() on null"?

public function donat ($player) {
        $api = $this->getServer()->getPluginManager()->getPlugin('FormAPI');
        $form = $api->createSimpleForm (function (Player $player, int $data = null) {
            if ($data === null) {
                return;
            }
            switch ($data) {
                case 0:
                    $this->fly ($player);
                break;
                case 1:


I DON'T UNDERSTAND WHAT'S WRONG

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daria Motorina, 2020-04-25
@va1errr

This means that $api is null, not an instance of the desired class, and it is not possible to call the createSimpleForm method.
In this method, $api appears out of thin air - it is neither passed from the outside nor created from within the method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question