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

Solved Command related stuff

Comments in 'Plugin Development' started by Tim // robske Büba, Jan 5, 2016.

  1. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    I want to check if that player is online (On an command):
    PHP:
    if($args[0] != instanceof(OnlinePlayer))
    That doesn't work :(
  2. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    ByTheWay: Tried to get if its the console by that
    PHP:
    if($args[0] = instanceof(CONSOLE))
    I do think i messed up the
    syntax!
  3. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    PHP:
    $player $this->getServer()->getPlayer($args[0]);
    if(
    $player instanceof Player and $player->isOnline() == true){
    // code
    }
    Tim // robske Büba likes this.
  4. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    Thanks
    If you want to get if its the console does that work:
    PHP:
    if($args[0instance CONSOLE{
    // code}
    And can you replace this
    PHP:
    $player $this->getServer()->getPlayer($args[0]);
    if(
    $player instanceof Player and $player->isOnline() == true){// code}
    with this?
    PHP:
    $player $this->getServer()->getPlayer($args[0]);
    if(
    $player instanceof Player && $player->isOnline() == true){// code}
  5. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    I really didn't understand you, lol...
    http://php.net/manual/es/language.operators.logical.php
  6. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    Thanks, that article helped me!
    But still:
    How to get if the console issues an command?
    PHP:
    if($sender instanceof CONSOLE{
    // code}
  7. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    I really don't know how to do it as well... Try this:
    PHP:
    if(!($sender instanceof Player)){
    }
    Tim // robske Büba likes this.
  8. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    That should work thanks :)
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder

Share This Page

Advertisement