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

My Plugin crashes, but I dont know why...

Discussion in 'Development' started by driver1848, Feb 23, 2020.

  1. driver1848

    driver1848 Spider Jockey

    Messages:
    35
    GitHub:
    driver1848
    I am currently writing a StartKick plugin, but it crashes when loading with a very strange error message...
    upload_2020-2-23_8-44-38.png
     
  2. Deniel

    Deniel Spider Jockey

    Messages:
    42
    GitHub:
    DenielWorld
    You are setting up your listener function incorrectly, please take a look at other plugins as a reference.
    Also using sleep() is not recommended, because it will freeze your whole server.
     
  3. driver1848

    driver1848 Spider Jockey

    Messages:
    35
    GitHub:
    driver1848
    Is this wrong?
    PHP:
            $this->getServer()->getPluginManager()->registerEvents($this$this);
    Edit: Ive also implements Listener
    Edit2: But how can I do something for a minute?
     
    Last edited: Feb 23, 2020
  4. Xenophilicy

    Xenophilicy Spider Jockey

    Messages:
    31
    GitHub:
    xenophilicy
    You should write your listener function like so:
    PHP:
    private function CloseChat(PlayerChatEvent $event){
        
    // crap
    }
    As for the error, there's probably a syntax error somewhere near the top of your plugin. Could you send the whole file?

    You can use scheduled (repeating/delayed if needed) tasks or even async tasks if you need to do something that needs to run for a certain amount of time. Although if you need a whole minute or longer, I suggest that you don't use async task as this would clog your async pool.
     
  5. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    must be a public function
     
  6. Xenophilicy

    Xenophilicy Spider Jockey

    Messages:
    31
    GitHub:
    xenophilicy
    Oh right, player events gotta be public lol
     
    Last edited: Feb 24, 2020
  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.