Files
Ragon/Ragon.Relay/Sources/RelayServerPlugin.cs
T

24 lines
608 B
C#
Raw Permalink Normal View History

2023-04-13 20:42:05 +04:00
using System;
using Newtonsoft.Json;
2023-04-09 11:06:52 +04:00
using Ragon.Server.Plugin;
2023-04-09 10:52:18 +04:00
namespace Ragon.Relay;
2023-04-13 20:42:05 +04:00
public class RelayServerPlugin: BaseServerPlugin
2023-04-09 10:52:18 +04:00
{
2023-04-13 20:42:05 +04:00
public override bool OnCommand(string command, string payload)
2023-04-09 10:52:18 +04:00
{
2023-04-13 20:42:05 +04:00
Console.WriteLine(command);
if (command == "kick-player")
{
var commandPayload = JsonConvert.DeserializeObject<KickPlayerCommand>(payload);
2023-04-14 14:32:24 +04:00
var player = Server.GetPlayerById(commandPayload.Id);
2023-04-13 20:42:05 +04:00
if (player != null)
player.Connection.Close();
else
Console.WriteLine($"Player not found with Id {commandPayload.Id}");
}
2023-04-09 10:52:18 +04:00
return true;
}
}