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

Undefined Method

Discussion in 'Development' started by Daniel23, Oct 15, 2017.

  1. Daniel23

    Daniel23 Witch

    Messages:
    65
    GitHub:
    daniel23
    PHP:
    case Item::CLOCK:
                
    $this->getServer()->dispatchCommand($player"cui testsimple");
                    break;
     
  2. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    getServer can be used only in class which is of PluginBase
     
  3. Daniel23

    Daniel23 Witch

    Messages:
    65
    GitHub:
    daniel23
    So what should I replace it with?
     
  4. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Create instance for main class and then call it in other class
     
  5. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    PHP:
    $this->urMainClass->getServer()->dispatchCommand($player"cui testsimple");
    dont forget to construct btw
     
  6. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    Server::getInstance()
     
  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.