1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved How can I get to run a class from another plugin from another plugin?

Discussion in 'Development' started by YunoSiwa, Jan 9, 2018.

  1. YunoSiwa

    YunoSiwa Spider

    Messages:
    9
    How can I get to run a class from another plugin from another plugin?


    I tried with getinstance but I have not had any results
     
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    $Server->getPluginManager()->getPlugin($Name)
     
    Last edited: Jan 10, 2018
  3. YunoSiwa

    YunoSiwa Spider

    Messages:
    9
    this time if I achieve it

    thank you very much! <3

    I used another syntax to do it and as I see it is not the same
     
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Oops, delete the "getInstance()" there. It was a typo.
     
  5. YunoSiwa

    YunoSiwa Spider

    Messages:
    9
    it's funny why I try it with the getInstance once and it worked for eos I thanked you but now it does not work hahaha

    The following error appears if I remove the getInstance

    [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'FormAPI v1.0.0': Undefined variable: Server on jojoe77777\FormAPI\FormAPI
    [01:45:29] [Server thread/CRITICAL]: ErrorException: "Undefined variable: Server" (EXCEPTION) in "CoreGames/src/YunoSiwa/CoreGames/Main" at line 124
     
  6. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    :facepalm: $Server refers to your server instance. You can get it with methods like Server::getInstance(), $this->getServer(), etc.
     
  7. YunoSiwa

    YunoSiwa Spider

    Messages:
    9
    haha not the problem had been caused because I had missed a } :p and also because what I wanted to execute was not the main class generating a $this on $this making the pl not work

    thank you for serving me :D
     
  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.