public void OnPlayerMove(IServer server, IClient client, MinecraftWrapper.Player.XPosition position) { if(config.Enabled) { if (player.ContainsKey(client.Name)) { ClientState state = player[client.Name]; if (state != null) { if (++state.Ticker >= state.TickerMax) { state.Ticker = 0; Vector3 spwanVector = config.SpawnPosition.ToVector3(); Vector3 playerVector = position.ToVector3(); if (config.IgnoreHeightAxis) { spwanVector.Y = 0.0; // radius without y playerVector.Y = 0.0; // radius without y } double distance = playerVector.Distance(spwanVector); if (!state.HasBeenWarned && distance >= config.WarningRadius) { server.SendExecuteResponse(client.Name, String.Format("Warning you're {0:0.0} units away from spawn, if you pass {1} you'll get teleported to home!", distance, config.HomeRadius)); state.HasBeenWarned = true; state.HasBeenTeleported = false; } if (!state.HasBeenTeleported && distance >= config.HomeRadius) { client.SendMessage("/home"); server.SendExecuteResponse(client.Name, String.Format("You have been teleported to home, because you were to far away from spawn!")); state.HasBeenWarned = false; state.HasBeenTeleported = true; } if (distance < config.WarningRadius) { state.HasBeenWarned = false; } } } } } }
public void OnPlayerMove(IServer server, IClient client, MinecraftWrapper.Player.XPosition position) { }
void npc_ClientException(object sender, MinecraftWrapper.WrapperEventArgs.ClientExceptionEventArgs e) { if (e.Exception != null) { messageQueue.Enqueue(String.Format(e.Exception.Message + Environment.NewLine)); } if (e.Message != null) { messageQueue.Enqueue(e.Message + Environment.NewLine); } }