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

Issue with my listener

Discussion in 'Facepalm' started by xXSirButterXx, Jun 27, 2017.

  1. xXSirButterXx

    xXSirButterXx Witch

    Messages:
    52
    GitHub:
    xxsirbutterxx
    [Deleted]
     
    Last edited: Jun 27, 2017
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Don't try to create multiple classes if you don't understand about OOP.
     
  3. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    1. Clean the mess
    Fix the code formatting, no one would be willing to help someone with a messy code. Looks like you are more likely copy posting code than actually writing it. Remove useless imports, functions and variables. The constructor is useless.

    2. Know what you're doing
    You haven't created a non static function getServer() in your class, neither is the class extending a
    your class have that function included (the class isn't extending another class, yeah I know). That is an issue that even a beginner would understand. That might be an exaggeration, whoops! let me rephrase that. That is an issue an average English speaker could understand. Seriously, the error literally says it all. "Call to undefined method". getServer() is an undefined method. What do you do when someone tells you to define something, something they probably don't have any idea of? Define it.
    An error as such doesn't mean you need to panic and Google it up right at that instant. Because, guess what? Errors can be read! Yeah, they aren't like those "An errorhas occurred. Look up code 'MINECRAFTBL4ZEonFire' to find a solution". They are there to assist you. They tell you what's wrong in the simplest of ways (exception to a few, for example the "Unexpected T_PAAMAYIM_NEKUDOTAYIM" error in PHP).

    3. Include as less code as possible in your threads
    This shan't be taken out of context. The imports ("use" statements) were useless. Pretty much everything was. Error tracing doesn't mean you dump the whole class in to your thread and let others figure out the error you're getting. Include only the useful information.
    "My class extending Listener gives out the following error, could anyone assist me on this? [INSERT ERROR HERE]"
     
    Last edited: Jun 27, 2017
  4. TheDiamondYT

    TheDiamondYT Zombie

    Messages:
    298
    GitHub:
    TheDiamondYT1
    You have quite a few undefined methods. Do you understand how PHP works? If yes, do you understand the concept of OOP (Object Orienented Programming)?
     
  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.