Execute command and get response back

Discussion in 'Spigot Plugin Development' started by simonmeusel, May 29, 2016.

  1. How can i execute a command (for example /blockdata) and get the response into a String?
     
  2. String of what?
     
  3. Like you know how /blockdata returns a string? He wants to get that same string but into his code
     
  4. If i type a command into the chat i get a response back:

    /blockdata 0 0 0 {}​

    I get back:

    The data tag did not change: {conditionMet:0b,auto:0b,CustomNam
    e:"@",powered:0b,Command:"",x:0,y:0,z:0,id:"Control",SuccessCount:0,TrackOutput:
    1b}​

    And i want to get that into a string
     
  5. you mean the respond?
     
  6. yes
     
  7. Mostly today's plugin dont really get a responde Message at all... but you can make a respone message your own self by using PreCommandProccesEvent
     
  8. I dont want to create my own response message, i want to execute a command and get the response of minecraft.
     
  9. i dont really see a soloution to this, i never saw someone catch the respone message of a command because mostly in minecraft servers response never really was a big Deal...
     
  10. That's right. But anyway?