protected override void OnEnable() { Application.EnableVisualStyles(); base.OnEnable(); Context.Server.LevelManager.LevelCreated += (sender, args) => { if (_biomeMapForm != null) { return; } CreateForm(args.Level); }; Context.Server.PlayerFactory.PlayerCreated += (sender, args) => { args.Player.PlayerJoin += (o, eventArgs) => { _biomeMapForm.UpdateLevel(); args.Player.SetEffect(new Speed() { Duration = Effect.MaxDuration, Level = 10, Particles = false }); }; }; }
private void Update(object state) { if (_biomeMapForm == null) { return; } if (!Monitor.TryEnter(_sync)) { return; } try { Console.WriteLine("Update Level"); _biomeMapForm?.UpdateLevel(); } finally { Monitor.Exit(_sync); } }