Server crash cause of getPlayer()

Discussion in 'Plugin Help' started by GeistFan, Nov 24, 2022.

  1. GeistFan

    GeistFan Slime

    Messages:
    84
    GitHub:
    GeistFan
    Hey I'm again
    I do not know why my Server crashed, i just used getPlayer()
    Heres the error: Call to undefined method ForeverCMD\main::getPlayer()
    Here is the code i think caused the error:
    Code:
        public function onPlayerJoin(PlayerJoinEvent $event)
        {
            $join = $this->getConfig()->get("join");
            $player = $this->getPlayer()->getName();
            $event->setJoinMessage(str_replace("{name}",$player,$join));
        }
        public function onPlayerQuit(PlayerQuitEvent $event)
        {
            $quit = $this->getConfig()->get("leave");
            $player = $this->getPlayer()->getName();
            $event->setQuitMessage(str_replace("{name}",$player,$quit));
        }
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.