public void ImportGrid(string filename, string playerName = null) { MyIdentity player; if (playerName == null) { if (Context.Player == null) { Context.Respond("You need to enter a Player name where the grid will be spawned at."); return; } player = ((MyPlayer)Context.Player).Identity; } else { player = PlayerUtils.GetIdentityByName(playerName); if (player == null) { Context.Respond("Player not Found!"); return; } } if (player.Character == null) { Context.Respond("Player has no character to spawn the grid close to!"); return; } var playerPosition = player.Character.PositionComp.GetPosition(); var result = GridManager.LoadGrid(Plugin.CreatePath(filename), playerPosition, false, false); if (result == GridImportResult.OK) { Context.Respond("Import Complete!"); } else { GridImportResultWriter.WriteResult(Context, result); Context.Respond("Import Failed!"); } }