Command execute() and Player Information

Discussion in 'Plugin Development' started by csma-cd, Feb 20, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    csma-cd

    Hello,

    I got a really newbie question (at least I guess). While changing from onCommand() to Command classes, I need to find a way to get the Player object, not the CommandSender. How to do it?

    Best Regards,

    CSMA-CD
     
  2. Offline

    matejdro

    Code:
    Player player = (Player) sender;
    But first you need to make sure that sender is really player:

    Code:
    Player player;
    if (sender instanceof Player)
    {    
        //Player sended command
        player = (Player) sender;
    }   
    else
    {
        //something else sended command (console, other plugin). Should we stop here?
    }
     
  3. Offline

    csma-cd

    \o/ THANKS!!!! I feel SOOOOO noob...
     
  4. Offline

    matejdro

  5. Offline

    csma-cd

    Another noob question regarding Command...

    What's the best solution for actually using Command framework? (Except YAML - I don't like it.)
     
  6. Offline

    matejdro

    What do you mean?
     
  7. Offline

    csma-cd

    What is the best way to write commands? Instantiating SimpleCommandMap and putting in a lot of Command inherited classes?
     
  8. Offline

    matejdro

    Alright, my knowledge ends here. I'm doing just a bunch of if-else statements with commands :)
     
Thread Status:
Not open for further replies.

Share This Page