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

Solved Error Message with kick/close-function

Discussion in 'Plugin Help' started by FunnyBuddys, Nov 12, 2018.

  1. FunnyBuddys

    FunnyBuddys Spider

    Messages:
    14
    GitHub:
    FunnyBuddys
    Hi,

    I tried to kick a Player while joining (PlayerPreLoginEvent)
    It works, but the console said
    Code:
    Error: "Call to a member function getIp() on null" (EXCEPTION) in "src/pocketmine/Player" at line 855
    My code:
    PHP:
    $event->getPlayer()->kick(TextFormat::RED "Du wurdest " TextFormat::GREEN "TEMPORÄR" TextFormat::RED " gebannt.\n" TextFormat::DARK_AQUA "Grund: " TextFormat::RED $config2->get("Grund") . "\n" TextFormat::RED "Bis: " TextFormat::YELLOW $config2->get("Dauer") . " Uhr"false);
    Anyone know, how to fix this?
     
    Primus likes this.
  2. SleepSpace9

    SleepSpace9 Slime

    Messages:
    78
    GitHub:
    sleepspace9
    Just cancel the event and set the kick message through $event->setKickMessage(...).
     
    Primus likes this.
  3. FunnyBuddys

    FunnyBuddys Spider

    Messages:
    14
    GitHub:
    FunnyBuddys
    Yep, worked!
    Thanks!
     
  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.