BattleBit-Community-Server-API/Program.cs

40 lines
873 B
C#
Raw Normal View History

2023-07-28 03:24:00 +03:00
using BattleBitAPI;
using BattleBitAPI.Server;
2023-08-10 13:31:19 +03:00
using System.Net;
2023-03-03 15:15:17 +03:00
class Program
{
static void Main(string[] args)
{
var listener = new ServerListener<MyPlayer, MyGameServer>();
2023-08-10 13:31:19 +03:00
listener.Start(29294);
listener.OnGameServerConnecting += OnGameServerConnecting;
2023-08-10 13:31:19 +03:00
2023-07-28 03:24:00 +03:00
Thread.Sleep(-1);
2023-03-03 15:15:17 +03:00
}
private static async Task<bool> OnGameServerConnecting(IPAddress ip)
{
return true;
}
2023-07-28 03:24:00 +03:00
}
class MyPlayer : Player<MyPlayer>
2023-07-28 03:24:00 +03:00
{
public int NumberOfSpawns = 0;
public override async Task OnSpawned()
{
this.NumberOfSpawns++;
base.GameServer.CloseConnection();
await Console.Out.WriteLineAsync("Spawn: " + this.NumberOfSpawns);
}
}
class MyGameServer : GameServer<MyPlayer>
{
public override async Task OnConnected()
{
Console.WriteLine(base.GameIP + " connected");
}
}