Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[New API] Get Current Player Protocol from Player class instance

Comments in 'Plugin Development' started by EvolSoft, May 2, 2015.

  1. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Hi,
    How can I get the Current Player Protocol from PocketMine Player class instance?
    This is my code:
    PHP:
    public function onLogin (PlayerLoginEvent $event){
      
    $player $event->getPlayer();
      
    $player->sendMessage("Your MCPE Current Protocol: " $player->getProtocol()); //getProtocol() function obviously doesn't exist. It's an example of what I want to do
    }
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    The player can only connect from one protocol, which is Info::CURRENT_PROTOCOL. If they connect from another protocol, $player->interface should be different. Use ReflectionClass to get that. (I'll ask shoghicp to make a getter)
    EvolSoft likes this.
  3. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Ok. Thank you :)

Share This Page

Advertisement