How To Get A String From A Command?

Discussion in 'Plugin Development' started by cheese5505, Nov 4, 2011.

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

    cheese5505

    This is something that i have wanted to know for quite alot of time.How would i get a string from a command? Like, if i say /kill bobby250, how would i get the string bobby250 and store it in a variable?
     
  2. Offline

    md_5

    String player = args[0];
     
  3. Offline

    thehutch

    If you want to convert that to a player then your going to have to try/catch it because it might not always be a player :D
     
  4. Offline

    cheese5505

    Thanks. How would I make more than 1 argument?
     
  5. Offline

    AlexDGr8r

    a command is done like this /command args[0] args[1] args[2]....
    Hope that helps.
     
  6. Offline

    cheese5505

    Yeah, thanks. But I'm not using it for a player plugin. But I might use that in another command.

    Wow, Thank you so much dude! Exactly what i need to know!

    Thanks all of you :D

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 21, 2016
Thread Status:
Not open for further replies.

Share This Page