SanAndreasUnity/Assets/Scripts/RCON/CommandInterpreter.cs
Antonio Alexandru Ganea c3aebc3826
RCON Support (#96)
* Added RCON dotnet submodule

* RCON Manager

* RCON works

* Switched inter-thread passing from tasks callbacks to BlockingCollection

* Cleanup

* Config based rcon port and password

* RCON is disabled by default in config

* Added SanAndreasUnity.RCON namespace to CommandInterpreter

* Pass command to main thread first and report progress afterwards

* Minor cleanup

* Removed InvalidOperationException as it was never possible

* Moved OnLoaderFinished code in RCONManager

* Added RCONManager script to prefab

* Added meta files
2020-11-01 23:51:03 +01:00

36 lines
No EOL
976 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace SanAndreasUnity.RCON
{
public class CommandInterpreter
{
public static String Interpret(String command)
{
string[] words = command.Split(' ');
if (command == "heartbeat")
{
// Implement heartbeat ping
return "Heartbeat was sent to master server";
}
if (command == "help")
{
return "The available commands for now are heartbeat, announce and help";
}
if (words[0] == "announce")
{
String announcement = String.Join(" ", words, 1, words.Length - 1);
SanAndreasUnity.Chat.ChatManager.SendChatMessageToAllPlayersAsServer(announcement);
return "Server : " + announcement;
}
return "Unknown command";
}
}
}