Ejemplo n.º 1
0
        private void GetData(GetDataEventArgs e)
        {
            PacketTypes type   = e.MsgID;
            var         player = TShock.Players[e.Msg.whoAmI];

            if (player == null)
            {
                e.Handled = true;
                return;
            }

            if (!player.ConnectionAlive)
            {
                e.Handled = true;
                return;
            }

            using (var data = new MemoryStream(e.Msg.readBuffer, e.Index, e.Length))
            {
                try
                {
                    if (GetDataHandlers.HandlerGetData(type, player, data))
                    {
                        e.Handled = true;
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }
            }
        }
Ejemplo n.º 2
0
        public override void Initialize()
        {
            TypesList.SetupTyps();

            NetHooks.GreetPlayer += OnGreetPlayer;
            ServerHooks.Leave    += OnLeave;
            NetHooks.GetData     += GetData;
            GameHooks.Initialize += OnInitialize;
            GameHooks.Update     += OnUpdate;
            ServerHooks.Chat     += OnChat;

            GetDataHandlers.InitGetDataHandler();
        }