protected virtual void OnDesyncDetected(DesyncEventArgs e) { PrepareEvent(e); #if DEBUG _chat.AddMessage("Desync detected, fixing..."); #endif logger.Info("Desync detected, fixing..."); foreach (var chunkPos in e.ChunksToSynchronize) { _chunks.ResyncChunk(chunkPos, true); } foreach (var entityId in e.EntitiesToSynchronize) { _server.ServerConnection.Send(new GetEntityMessage { DynamicEntityId = entityId }); } var handler = DesyncDetected; if (handler != null) { handler(this, e); } }
private bool AnalyseAction(string command) { bool commandProcessed = false; try { if (string.IsNullOrEmpty(command) == false && command[0] == '/') { string[] splittedCmd = command.Split(' '); commandProcessed = true; switch (splittedCmd[0].ToLower()) { case "/reloadtex": //Refresh the texture pack values TexturePackConfig.Current.Load(); _worldChunk.InitDrawComponents(_engine.ImmediateContext); break; case "/staticinstanced": //Swith from/to static instanced drawing for static entities _worldChunk.DrawStaticInstanced = !_worldChunk.DrawStaticInstanced; break; case "/fpslimit": _mainGameLoop.FramelimiterTime = (long)(1.0 / long.Parse(splittedCmd[1]) * 1000.0); break; case "/ping": //Send a ping to the server without using the chat system _pingTimer.Restart(); _server.ServerConnection.Send(new PingMessage() { Request = true }); break; case "/resync": _worldChunk.ResyncChunk((Vector3I)_server.Player.Position, true); break; case "/rebuild": _worldChunk.RebuildChunk((Vector3I)_server.Player.Position); break; case "/freezetime": _gameClock.FrozenTime = !_gameClock.FrozenTime; break; default: commandProcessed = false; break; } } } catch (Exception e) { logger.Error("Error processing Admin command : {0}, error raised : {1}", command, e.Message); } return(commandProcessed); }