mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-23 04:23:04 +00:00
c3aebc3826
* 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
36 lines
No EOL
976 B
C#
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";
|
|
}
|
|
}
|
|
|
|
} |