Add new REST endpoint:

- /v2/server/rawcmd

Takes parameters:
 - cmd

Commands have to start with /, some commands aren't written properly, and may not return any more output than a status code.
This commit is contained in:
Lucas Nicodemus 2012-01-02 22:14:30 -07:00
parent f04b9d7a6d
commit b8e4dffd74
4 changed files with 74 additions and 27 deletions

View file

@ -405,6 +405,36 @@ namespace TShockAPI
}
}
public class TSRestPlayer : TSServerPlayer
{
internal List<string> CommandReturn = new List<string>();
public TSRestPlayer()
{
Group = new SuperAdminGroup();
}
public override void SendMessage(string msg)
{
SendMessage(msg, 0, 255, 0);
}
public override void SendMessage(string msg, Color color)
{
SendMessage(msg, color.R, color.G, color.B);
}
public override void SendMessage(string msg, byte red, byte green, byte blue)
{
CommandReturn.Add(msg);
}
public List<string> GetCommandOutput()
{
return CommandReturn;
}
}
public class TSServerPlayer : TSPlayer
{
public TSServerPlayer()