public override void Initialize() { ServerApi.Hooks.NetGetData.Register(this, GetData); ServerApi.Hooks.NetGreetPlayer.Register(this, GreetPlayer); ServerApi.Hooks.ServerLeave.Register(this, PlayerLeave); ServerApi.Hooks.GameInitialize.Register(this, OnInitialize); ServerApi.Hooks.GamePostInitialize.Register(this, OnGameInitialize); PlayerHooks.PlayerPostLogin += PlayerPostLogin; GetDataHandlers.InitGetDataHandler(); _counter.Elapsed += CounterOnElapsed; _counter.Start(); _timeSaver.Elapsed += TimeSaverOnElapsed; _timeSaver.Start(); TShockAPI.Commands.ChatCommands.Add(new Command("statistics.root", Commands.Core, "stats") { AllowServer = true }); TShockAPI.Commands.ChatCommands.Add(new Command("statistics.blitzevent", Commands.BlitzMatch, "blitzevent", "be") { AllowServer = true }); TShockAPI.Commands.ChatCommands.Add(new Command("statistics.speedspree", Commands.SpeedSpree, "speedspree", "ss") { AllowServer = true }); }
private static void GetData(GetDataEventArgs args) { var type = args.MsgID; var player = TShock.Players[args.Msg.whoAmI]; if (player == null) { args.Handled = true; return; } if (!player.ConnectionAlive) { args.Handled = true; return; } using (var data = new MemoryStream(args.Msg.readBuffer, args.Index, args.Length)) { try { if (GetDataHandlers.HandlerGetData(type, player, data)) { args.Handled = true; } } catch (Exception ex) { TShock.Log.ConsoleError(ex.ToString()); } } }
public override void Initialize() { ServerApi.Hooks.GameInitialize.Register(this, OnInitialize); ServerApi.Hooks.NetGreetPlayer.Register(this, OnGreet); ServerApi.Hooks.ServerLeave.Register(this, OnLeave); ServerApi.Hooks.GamePostInitialize.Register(this, PostInitialize); ServerApi.Hooks.ServerChat.Register(this, OnChat); ServerApi.Hooks.NetGetData.Register(this, GetData); TShockAPI.Hooks.PlayerHooks.PlayerPostLogin += PostLogin; GetDataHandlers.InitGetDataHandler(); }
public override void Initialize() { ServerApi.Hooks.NetGetData.Register(this, GetData); ServerApi.Hooks.NetGreetPlayer.Register(this, GreetPlayer); ServerApi.Hooks.ServerLeave.Register(this, PlayerLeave); ServerApi.Hooks.GameInitialize.Register(this, OnInitialize); PlayerHooks.PlayerPostLogin += PlayerPostLogin; GetDataHandlers.InitGetDataHandler(); _counter.Elapsed += CounterOnElapsed; _counter.Start(); _timeSaver.Elapsed += TimeSaverOnElapsed; _timeSaver.Start(); TShockAPI.Commands.ChatCommands.Add(new Command("statistics.root", Commands.Core, "info")); }