2023-04-13 20:42:05 +04:00
|
|
|
using System;
|
|
|
|
|
using Newtonsoft.Json;
|
2024-01-13 15:15:29 +03:00
|
|
|
using Ragon.Server;
|
2023-04-09 11:06:52 +04:00
|
|
|
using Ragon.Server.Plugin;
|
2023-04-09 10:52:18 +04:00
|
|
|
|
2024-05-19 11:28:36 +03:00
|
|
|
namespace Ragon.Relay
|
2023-04-09 10:52:18 +04:00
|
|
|
{
|
2024-05-19 11:28:36 +03:00
|
|
|
|
|
|
|
|
public class RelayServerPlugin : BaseServerPlugin
|
2023-04-09 10:52:18 +04:00
|
|
|
{
|
2024-05-19 11:28:36 +03:00
|
|
|
public override bool OnCommand(string command, string payload)
|
2023-04-13 20:42:05 +04:00
|
|
|
{
|
2024-05-19 11:28:36 +03:00
|
|
|
Console.WriteLine(command);
|
|
|
|
|
if (command == "kick-player")
|
|
|
|
|
{
|
|
|
|
|
var commandPayload = JsonConvert.DeserializeObject<KickPlayerCommand>(payload);
|
|
|
|
|
var player = Server.GetContextById(commandPayload.Id);
|
|
|
|
|
if (player != null)
|
|
|
|
|
player.Connection.Close();
|
|
|
|
|
else
|
|
|
|
|
Console.WriteLine($"Player not found with Id {commandPayload.Id}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
2023-04-13 20:42:05 +04:00
|
|
|
}
|
2024-01-13 15:15:29 +03:00
|
|
|
|
2024-05-19 11:28:36 +03:00
|
|
|
public override IRoomPlugin CreateRoomPlugin(RoomInformation information)
|
|
|
|
|
{
|
|
|
|
|
return new RelayRoomPlugin();
|
|
|
|
|
}
|
2024-01-13 15:15:29 +03:00
|
|
|
}
|
2023-04-09 10:52:18 +04:00
|
|
|
}
|