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

Solved Allow a banned player to join the server?

Discussion in 'Development' started by romainbizet46, Dec 9, 2017.

  1. romainbizet46

    romainbizet46 Witch

    Messages:
    52
    Hey

    Today i m asked myself how can allow a player who is banned to join the server and add some code in the fonction?
     
  2. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Cancel PlayerKickEvent
     
  3. romainbizet46

    romainbizet46 Witch

    Messages:
    52
    A player who is banned and want to join getPlayerKickEvent?
    Good to know thx to your usfull help;)
     
  4. EdwardHamHam

    EdwardHamHam Skeleton

    Messages:
    962
    GitHub:
    edwardhamham
    Why not just unban them?
     
    Kyd and QuiverlyRivalry like this.
  5. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    jasonwynn10 and EdwardHamHam like this.
  6. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    He probably wants to teleport/transfer a banned player somewhere where the player can read rules, see a clock or can apologise/whatever
     
    romainbizet46 likes this.
  7. romainbizet46

    romainbizet46 Witch

    Messages:
    52
    HimbeersaftLP likes this.
  8. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Don't forget to block chat for that person too :D
     
    romainbizet46 likes this.
  9. romainbizet46

    romainbizet46 Witch

    Messages:
    52
    That fuk*** good idea
    PHP:
    public function bannedPlayer(PlayerKickEvent $eventPlayerChatEvent $chat){
            
    $player $event->getPlayer();
            if(
    $player->isBanned()){
                
    $player->setImmobile(true);
                
    $chat->setCancelled();
                
    $event->setCancelled();
            }
        }
     
    Last edited: Dec 9, 2017
    Levi likes this.
  10. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    whats setImmobile?
     
  11. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    you totally get it wrong
    you need to create another function for the playerchatevent with the isbanned then set to canceled
     
    romainbizet46 likes this.
  12. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Test it and you get it :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.