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

Getting username of the issuer of a command

Comments in 'Plugin Development' started by Renzo, Jun 28, 2014.

  1. Renzo
    Offline

    Renzo Active Member

    Joined:
    Mar 12, 2014
    Posts:
    96
    Minecraft User:
    Renzo_4
    How so you get the name of the issuer that has run a command and then save the name in a variable and than say the name of the issuer to the chat?
    Last edited: Jun 28, 2014
  2. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    in the old api its $username = $issuer->username new api the issuer is $sender
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    $sender and $issuer just depend on how you define your variable. I like using $issuer or $isr or $p in all APIs :D
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Also, $sender->getName().
  5. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    Old API: $issuer->username
    New API: $sender->getName()
    iFootball likes this.
  6. Renzo
    Offline

    Renzo Active Member

    Joined:
    Mar 12, 2014
    Posts:
    96
    Minecraft User:
    Renzo_4
    And how do you kick the player?
  7. Killman2
    Offline

    Killman2 Active Member Plugin Developer

    Joined:
    May 5, 2014
    Posts:
    81
    Plugins:
    1
    Minecraft User:
    Killman2
    With old API, I do that:

    PHP:
    $user $issuer->username;

    $this->api->console->run("kick $user");
  8. EggGamer
    Offline

    EggGamer New Member

    Joined:
    Jun 12, 2014
    Posts:
    30
    Minecraft User:
    hunyahemee
    Thanks guy
  9. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    in the new api it's $sender->kick(reason);
  10. Killman2
    Offline

    Killman2 Active Member Plugin Developer

    Joined:
    May 5, 2014
    Posts:
    81
    Plugins:
    1
    Minecraft User:
    Killman2
    Old API :
    PHP:
     $this->api->ban->kick($issuer); 
    New API :
    PHP:
     $plr $sender->getName();
                  
    $plr->kick();
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Why do people call old API command issuers $issuer and those in new API $sender?
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    As if they differ.
  13. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    we don't call them that but most of the people copy and paste from other people's codes (not me ) $sender is callable you can use what ever you want
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I think it is
    because it is $sender at CommandSender.php, so normally codes copy their parent.
  15. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I think it is
    because it is $sender at CommandSender.php, so normally codes copy their parent.

Share This Page

Advertisement