Answer the question
In order to leave comments, you need to log in
"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:
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question